perf(javascript): reduce analysis and source-map work (#955)

* perf(javascript): reduce semantic traversal overhead

* perf(source-maps): reuse validated regular map rows
This commit is contained in:
morluto authored and GitHub committed 2026-10-07 20:33:35 +08:00
1 parent dda8e6a728
commit c7530f9a81
6 files changed
+59 -10

No files matched your search

@@ -51,3 +51,16 @@ it("preserves source-tree enter/exit order and detached ancestor snapshots", ()
],
]);
});
it("skips sparse child slots without disturbing sibling visit order", () => {
const parsed = parseJavaScriptSource("const values = [first, , second];");
if (parsed === null)
throw new TypeError("Expected a parsed JavaScript fixture");
const identifiers: string[] = [];
traverseJavaScriptAst(parsed.program, {
enter: (node) => {
if (t.isIdentifier(node)) identifiers.push(node.name);
},
});
expect(identifiers).toEqual(["values", "first", "second"]);
});