Parents: #465, #498 Related: #706, #724
Problem
Compiler.compileExpr rejects every array/object destructuring assignment when self.scope != null, so an otherwise eligible plain function or method falls back wholesale:
.arr_pattern, .obj_pattern => {
if (self.scope != null) return error.Unsupported;
...
}Generator/async environment mode already owns a bytecode-native pattern compiler for suspended defaults/computed keys. #706 generalized its temporaries to activation-local scratch for programs, and #724 expanded object-rest assignment targets. Frame mode can use the same native path with frame-local ActivationTemp values; retaining the bind_pattern tree-walker callback is not a valid completion because it cannot write statically resolved frame/upvalue slots.
Scope
- Lower array/object destructuring assignment in plain functions and methods through the existing native pattern compiler.
- Preserve RHS result identity, nested patterns, holes/rest, defaults, computed keys, identifier/member/super targets, anonymous-function naming, and one-time Reference evaluation.
- Preserve IteratorDestructuringAssignmentEvaluation ordering, IteratorClose on normal early completion and abrupt completion, RequireObjectCoercible, ToPropertyKey, CopyDataProperties exclusion order, and PutValue timing.
- Keep dynamic
with/binding cases fail-closed when an activation-owned resolved binding reference is still required. - Admit the same construct through program, plain, generator, async, and async-generator modes without routing a bytecode instruction back into the tree-walker.
- Keep native tiers fail-closed until their root maps and side exits model every new opcode/state they execute.
No-workaround rules
- No synthesized globals, AST-identity caches, duplicated RHS/key/default evaluation, relaxed IteratorClose, environment-only shadow writes, or hidden tree-walker callback inside an admitted bytecode chunk.
- No stacks, queues, jobs, Promise, microtask, Worker-lifecycle, or Map/Set iterator changes.
Acceptance
- Compiler tests prove plain frame/upvalue/global targets use native pattern lowering and no
bind_pattern. - Forced tree-walker ↔ required-bytecode differentials cover nested array/object/rest/default/computed/member/super targets and abrupt iterator closure.
- Generator/async suspension, moving GC, debugger/watchdog, and TSan witnesses preserve exact activation-local References.
- Exact nonzero Test262 destructuring-assignment before → after accounting has zero regressions.
- Focused compiler/frontend, full sharded units, and applicable sanitizer gates pass.