fix(javascript): handle deep AST traversal and addition without stack overflow (#915)

* fix(javascript): avoid recursion and eager ancestry copies in deep ASTs

* fix(javascript): traverse static analysis and bundler ASTs iteratively
This commit is contained in:
morluto
2026-10-07 17:40:05 +08:00
committed by GitHub
parent f6a58f1062
commit 62b37111e7
9 changed files with 203 additions and 40 deletions
@@ -282,6 +282,9 @@ describe("primitive addition values", () => {
['"x" + false', "xfalse"],
['null + "x"', "nullx"],
["3 + 4", 7],
['1 + 2 + "3"', "33"],
['1 + (2 + "3")', "123"],
['(1 + 2) + ("3" + 4)', "334"],
])("recovers %s using primitive coercion", (expression, expected) => {
const ir = analyzeJavaScriptSemantics(`const answer = ${expression};`);
expect(topLevelBinding(ir, "answer").value).toEqual({