From 7fb584d929d8c20848336381309d71a130870de1 Mon Sep 17 00:00:00 2001 From: c0dev0id Date: Mon, 6 Jul 2026 21:10:46 +0200 Subject: [PATCH] refactor: rename rawChildren to unknownSlots --- static/ast-parser.js | 20 ++++++++++---------- test-parser.mjs | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/static/ast-parser.js b/static/ast-parser.js index 2327832..faaf9ca 100644 --- a/static/ast-parser.js +++ b/static/ast-parser.js @@ -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)); } } diff --git a/test-parser.mjs b/test-parser.mjs index 5fd31fd..02f92a6 100644 --- a/test-parser.mjs +++ b/test-parser.mjs @@ -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');