mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-14 19:27:05 -04:00
An expression nested about 60 brackets deep overflowed the stack of a 2 MiB thread in the JavaScript parser (release and debug; ~200 levels on 8 MiB), which aborts the whole app: it can't be caught. The array-maths rewrite also nests one call per arithmetic operator, so a long sum went the same way, and the rewriter itself recursed per bracket. rewrite() now measures the nesting (brackets plus chains of prefix operators) before and after rewriting and turns an expression deeper than MAX_NESTING (32) into a RangeError; check_syntax reports the same error. Also replaces the unreachable!() in the bracket-tree builder with a let-chain, and denies the panic lints in the crate. Co-Authored-By: Claude Opus 5.5 <[email protected]>