Parents: #465, #496 Related: #619, #714
Problem
The bytecode compiler rejects every class expression with ClassHeritage, including otherwise supported generator and async bodies. Computed class element names already lower in source order and can suspend, but the heritage expression is still delegated wholesale to the tree-walker. This prevents correct bytecode admission for class extends Base {}, class extends (yield Base) {}, and class extends (await Base) {}.
Heritage cannot simply be evaluated before the existing eval_class opcode: a named class binding must already exist in TDZ, constructor/prototype validation must complete before any computed element name runs, and the class lexical environment must remain live through class construction and deferred member capture.
Scope
- Enter one activation-local class lexical Environment before heritage evaluation and predeclare a named class binding with the exact TDZ/const contract.
- Evaluate the heritage expression in strict class code, then immediately validate the constructor and its
prototypeonce. - Preserve the prepared superclass constructor/prototype as precise VM operand roots across
yield/await, then evaluate computed element names in source order. - Build the class in the already-active class Environment without re-evaluating heritage or re-reading
prototype. - Preserve
extends null, named-class TDZ, getter/throw ordering, private-name rewriting, static initialization, method/field capture, abrupt environment unwinding, moving GC, and native-tier fallback.
No-workaround rules
- No eager tree-walker evaluation, duplicate
prototypelookup, source rewriting, global scratch, shared mutable staging, skipped class environment, broad class admission, or stacks/queues/jobs/Promise/Worker changes.
Acceptance
- Program, plain-function, generator, async, and async-generator admission covers ordinary, suspended, and awaited heritage where the surrounding tier supports it.
- Forced tree-walker/required-bytecode witnesses prove exact result, TDZ,
prototypegetter, computed-key, throw,extends null, and static initialization order. - Moving-GC and suspension tests prove prepared heritage values and the class Environment remain precise roots.
- Focused compiler/VM/frontend, TSan, full units, and exact nonzero Test262 class-heritage accounting pass with zero regressions.
- Parent/related issues and the landed commit are cross-linked with quantified evidence.