refactor: rename rawChildren to unknownSlots

This commit is contained in:
c0dev0id
2026-07-06 21:10:46 +02:00
parent e823608325
commit 7fb584d929
2 changed files with 15 additions and 15 deletions

View File

@@ -222,7 +222,7 @@ function buildInstrument(node) {
timbre: null,
fmModulations: [],
amModulations: [],
rawChildren: [],
unknownSlots: [],
};
for (const child of node.children) {
@@ -246,7 +246,7 @@ function buildInstrument(node) {
instr.amModulations.push({ ...child.props });
break;
default:
instr.rawChildren.push(buildGeneric(child));
instr.unknownSlots.push(buildGeneric(child));
}
}
@@ -262,7 +262,7 @@ function buildVariation(node) {
subvariations: [],
spread: null,
railsbackCurve: null,
rawChildren: [],
unknownSlots: [],
};
for (const child of node.children) {
@@ -284,7 +284,7 @@ function buildVariation(node) {
v.railsbackCurve = buildShape(child);
break;
default:
v.rawChildren.push(buildGeneric(child));
v.unknownSlots.push(buildGeneric(child));
}
}
@@ -298,7 +298,7 @@ function buildBasicProperties(node) {
oscillator: null,
fmModulations: [],
amModulations: [],
rawChildren: [],
unknownSlots: [],
};
for (const child of node.children) {
@@ -322,7 +322,7 @@ function buildBasicProperties(node) {
if (envChild) am.shape = buildShape(envChild);
bp.amModulations.push(am);
} else {
bp.rawChildren.push(buildGeneric(child));
bp.unknownSlots.push(buildGeneric(child));
}
}
@@ -334,7 +334,7 @@ function buildLabelSpec(node) {
type: 'label_spec',
label: node.positionals[0],
basicProperties: null,
rawChildren: [],
unknownSlots: [],
};
const directBpChildren = [];
@@ -348,7 +348,7 @@ function buildLabelSpec(node) {
) {
directBpChildren.push(child);
} else {
ls.rawChildren.push(buildGeneric(child));
ls.unknownSlots.push(buildGeneric(child));
}
}
if (!ls.basicProperties && directBpChildren.length > 0) {
@@ -386,7 +386,7 @@ function buildBar(node) {
upperStressBound: null,
tunings: [],
voices: {},
rawChildren: [],
unknownSlots: [],
};
for (const child of node.children) {
@@ -414,7 +414,7 @@ function buildBar(node) {
bar.voices[child.positionals[0]] = buildVoice(child);
break;
default:
bar.rawChildren.push(buildGeneric(child));
bar.unknownSlots.push(buildGeneric(child));
}
}

View File

@@ -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
// ── 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.
section('FM modulation with embedded shape (synthetic)');
const FM_FIXTURE = `00 instrument 'test'
@@ -692,10 +692,10 @@ const UNK_FIXTURE = `00 instrument 'test'
const unkModel = buildModel(parseAstLog(UNK_FIXTURE));
const unkInstr = unkModel.instruments[0];
ok('unknown slot: instrument parsed', !!unkInstr);
ok('unknown slot: rawChildren is array', Array.isArray(unkInstr.rawChildren));
ok('unknown slot: instrument-level unknown collected', unkInstr.rawChildren.length === 1);
ok('unknown slot: collected slot type', unkInstr.rawChildren[0].type === 'FUTURE_SLOT');
ok('variation-level unknown collected', unkInstr.variations[0]?.rawChildren?.length === 1);
ok('unknown slot: unknownSlots is array', Array.isArray(unkInstr.unknownSlots));
ok('unknown slot: instrument-level unknown collected', unkInstr.unknownSlots.length === 1);
ok('unknown slot: collected slot type', unkInstr.unknownSlots[0].type === 'FUTURE_SLOT');
ok('variation-level unknown collected', unkInstr.variations[0]?.unknownSlots?.length === 1);
section('Full fixture integration');
ok('fixture parses without error (checked above)', raw && raw.slot === 'root');