Parents: #465, #493 Related: #726, #729
Problem
#726 gave plain functions native destructuring assignment, but a plain-function var, let, or const destructuring declaration still returns unsupported_lowering. The frame compiler neither hoists pattern-bound var names nor predeclares block-scoped pattern bindings, so the existing native pattern evaluator cannot safely target activation slots.
Scope
- Hoist every function-scoped
varbinding inside nested array/object patterns into the owning activation. - Predeclare every block-scoped destructuring binding in its exact lexical scope and initialize all bindings to TDZ before evaluating the declaration initializer.
- Lower array/object declaration BindingInitialization through activation-owned bytecode for frame slots, mapped parameters, captured upvalues, and repeated-body Environment Records.
- Preserve computed-key/default ordering, iterator close, object rest, duplicate
varbehavior, const assignment checks, shadowing, abrupt completion, recursion, activation reuse, moving GC, and no-GIL sharing. - Keep program/generator/async behavior and the tree-walker semantic baseline exact.
No-workaround rules
- No syntax refusal, source rewriting, synthesized global names, tree-walker fallback presented as coverage, heuristic cutoff, weakened TDZ/const behavior, or duplicated iterator/property evaluation.
- No stacks, queues, jobs, Promise, microtask, Worker lifecycle, or Map/Set iterator changes.
Acceptance
- Compiler admission proves representative plain destructuring declarations contain native iterator/object-rest/frame stores and no
bind_pattern. - Forced tree-walker and required bytecode agree on initializer/key/default order, TDZ, const, hoisted
var, closures, mapped parameters, abrupt IteratorClose, recursion, activation reuse, and moving GC. - Focused compiler/frontend/VM, full units, applicable TSan/no-GIL, and relevant nonzero Test262 declaration/destructuring subtrees pass with exact accounting.
- Conventional commit lands directly on main and cross-links #465, #493, #726, and #729.