Parents: #465, #493 Related: #731
Problem
Plain frame-mode functions can lower a with statement, but ordinary identifier reads/calls and simple/compound/update assignments still select load_local/load_upval/store_local statically. A captured Object Environment Record must participate before the frame boundary, including observable Proxy has traps and Symbol.unscopables; calls also require the exact WithBaseObject for this. The existing comment that any function using with falls back is not true.
#731 adds activation-owned identifier References for destructuring and simple var initialization only. Reusing that primitive for the general expression surface is a separate complete lowering.
Scope
- Resolve ordinary IdentifierReference reads and calls through activation-local and captured
withEnvironment Records before static local/upvalue/global fallback. - Preserve WithBaseObject call
this, direct-eval identity,typeof, strict/sloppy assignment, compound/logical assignment, prefix/postfix update, and evaluation order. - Bound environment walks at exact frame/upvalue boundaries and retain direct bytecodes when no dynamic record can intervene.
- Extend native-tier admission only when guards/fallback preserve the same resolution contract.
- Add nested-function/captured-
with, Proxy/@@unscopables, recursion, suspension, moving/concurrent GC, and no-GIL witnesses.
No-workaround rules
No delayed re-resolution, duplicated HasBinding, source rewriting, synthesized globals, heuristic syntax refusal presented as implementation, or unsafe raw Environment/Object pointers. No stacks, queues, jobs, Promise, microtask, Worker lifecycle, or Map/Set iterator changes.
Acceptance
- Tree-walker and required bytecode agree on exact observable lookup/GetValue/PutValue/call order and destinations.
- Static no-
withfunctions retain their current direct bytecodes and native-tier eligibility. - Focused compiler/frontend/VM, full units, TSan/no-GIL, and relevant nonzero Test262 coverage pass with exact accounting.
- Landing commit cross-links #465, #493, and #731.