refactor: rename rawChildren to unknownSlots
This commit is contained in:
@@ -222,7 +222,7 @@ function buildInstrument(node) {
|
|||||||
timbre: null,
|
timbre: null,
|
||||||
fmModulations: [],
|
fmModulations: [],
|
||||||
amModulations: [],
|
amModulations: [],
|
||||||
rawChildren: [],
|
unknownSlots: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const child of node.children) {
|
for (const child of node.children) {
|
||||||
@@ -246,7 +246,7 @@ function buildInstrument(node) {
|
|||||||
instr.amModulations.push({ ...child.props });
|
instr.amModulations.push({ ...child.props });
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
instr.rawChildren.push(buildGeneric(child));
|
instr.unknownSlots.push(buildGeneric(child));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ function buildVariation(node) {
|
|||||||
subvariations: [],
|
subvariations: [],
|
||||||
spread: null,
|
spread: null,
|
||||||
railsbackCurve: null,
|
railsbackCurve: null,
|
||||||
rawChildren: [],
|
unknownSlots: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const child of node.children) {
|
for (const child of node.children) {
|
||||||
@@ -284,7 +284,7 @@ function buildVariation(node) {
|
|||||||
v.railsbackCurve = buildShape(child);
|
v.railsbackCurve = buildShape(child);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
v.rawChildren.push(buildGeneric(child));
|
v.unknownSlots.push(buildGeneric(child));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ function buildBasicProperties(node) {
|
|||||||
oscillator: null,
|
oscillator: null,
|
||||||
fmModulations: [],
|
fmModulations: [],
|
||||||
amModulations: [],
|
amModulations: [],
|
||||||
rawChildren: [],
|
unknownSlots: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const child of node.children) {
|
for (const child of node.children) {
|
||||||
@@ -322,7 +322,7 @@ function buildBasicProperties(node) {
|
|||||||
if (envChild) am.shape = buildShape(envChild);
|
if (envChild) am.shape = buildShape(envChild);
|
||||||
bp.amModulations.push(am);
|
bp.amModulations.push(am);
|
||||||
} else {
|
} else {
|
||||||
bp.rawChildren.push(buildGeneric(child));
|
bp.unknownSlots.push(buildGeneric(child));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ function buildLabelSpec(node) {
|
|||||||
type: 'label_spec',
|
type: 'label_spec',
|
||||||
label: node.positionals[0],
|
label: node.positionals[0],
|
||||||
basicProperties: null,
|
basicProperties: null,
|
||||||
rawChildren: [],
|
unknownSlots: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const directBpChildren = [];
|
const directBpChildren = [];
|
||||||
@@ -348,7 +348,7 @@ function buildLabelSpec(node) {
|
|||||||
) {
|
) {
|
||||||
directBpChildren.push(child);
|
directBpChildren.push(child);
|
||||||
} else {
|
} else {
|
||||||
ls.rawChildren.push(buildGeneric(child));
|
ls.unknownSlots.push(buildGeneric(child));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ls.basicProperties && directBpChildren.length > 0) {
|
if (!ls.basicProperties && directBpChildren.length > 0) {
|
||||||
@@ -386,7 +386,7 @@ function buildBar(node) {
|
|||||||
upperStressBound: null,
|
upperStressBound: null,
|
||||||
tunings: [],
|
tunings: [],
|
||||||
voices: {},
|
voices: {},
|
||||||
rawChildren: [],
|
unknownSlots: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const child of node.children) {
|
for (const child of node.children) {
|
||||||
@@ -414,7 +414,7 @@ function buildBar(node) {
|
|||||||
bar.voices[child.positionals[0]] = buildVoice(child);
|
bar.voices[child.positionals[0]] = buildVoice(child);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bar.rawChildren.push(buildGeneric(child));
|
bar.unknownSlots.push(buildGeneric(child));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ ok('patched score is non-empty', patched.length > 100);
|
|||||||
ok('patched score has no double blank lines beyond original', true); // structural sanity only
|
ok('patched score has no double blank lines beyond original', true); // structural sanity only
|
||||||
|
|
||||||
// ── FM modulation with embedded shape (synthetic) ─────────────────────────
|
// ── FM modulation with embedded shape (synthetic) ─────────────────────────
|
||||||
// The fixture's FM+shape is inside PROFILE.partial (rawChildren) and unreachable
|
// The fixture's FM+shape is inside PROFILE.partial (unknownSlots) and unreachable
|
||||||
// from buildBasicProperties. Verify with a synthetic AST log fragment.
|
// from buildBasicProperties. Verify with a synthetic AST log fragment.
|
||||||
section('FM modulation with embedded shape (synthetic)');
|
section('FM modulation with embedded shape (synthetic)');
|
||||||
const FM_FIXTURE = `00 instrument 'test'
|
const FM_FIXTURE = `00 instrument 'test'
|
||||||
@@ -692,10 +692,10 @@ const UNK_FIXTURE = `00 instrument 'test'
|
|||||||
const unkModel = buildModel(parseAstLog(UNK_FIXTURE));
|
const unkModel = buildModel(parseAstLog(UNK_FIXTURE));
|
||||||
const unkInstr = unkModel.instruments[0];
|
const unkInstr = unkModel.instruments[0];
|
||||||
ok('unknown slot: instrument parsed', !!unkInstr);
|
ok('unknown slot: instrument parsed', !!unkInstr);
|
||||||
ok('unknown slot: rawChildren is array', Array.isArray(unkInstr.rawChildren));
|
ok('unknown slot: unknownSlots is array', Array.isArray(unkInstr.unknownSlots));
|
||||||
ok('unknown slot: instrument-level unknown collected', unkInstr.rawChildren.length === 1);
|
ok('unknown slot: instrument-level unknown collected', unkInstr.unknownSlots.length === 1);
|
||||||
ok('unknown slot: collected slot type', unkInstr.rawChildren[0].type === 'FUTURE_SLOT');
|
ok('unknown slot: collected slot type', unkInstr.unknownSlots[0].type === 'FUTURE_SLOT');
|
||||||
ok('variation-level unknown collected', unkInstr.variations[0]?.rawChildren?.length === 1);
|
ok('variation-level unknown collected', unkInstr.variations[0]?.unknownSlots?.length === 1);
|
||||||
|
|
||||||
section('Full fixture integration');
|
section('Full fixture integration');
|
||||||
ok('fixture parses without error (checked above)', raw && raw.slot === 'root');
|
ok('fixture parses without error (checked above)', raw && raw.slot === 'root');
|
||||||
|
|||||||
Reference in New Issue
Block a user