Parent: #465. Related: #803, #806.
Reproduction and current boundary
At a6feac57, ordinary-function admission still rejects a class whose computed element name references that class's own private name:
function f() {
class Box {
#value;
[globalThis.#value] = 1;
}
}The parser correctly accepts the source and enforces that the private name is lexically visible. The tree-walker creates a fresh class PrivateEnvironment, mints the class's private-name identities, rewrites a per-evaluation member copy, and evaluates computed names under that map. VM class lowering instead evaluates heritage and every computed name eagerly before eval_class; Compiler.addMemberName must reject the unresolved raw #value, because treating it as a public property would erase the required private brand check.
This is one of the four computed-class/private-visibility failures retained after #806. The existing rejection is correctness-preserving, but universal eligibility remains incomplete.
Scope
- Create the class's per-evaluation private environment after heritage validation and before computed element-name evaluation, matching ClassDefinitionEvaluation ordering.
- Let eagerly lowered computed names resolve raw private references through that exact environment, including get/set/update/call/
#name inand direct eval where reachable. - Reuse the same freshly minted private-name identities when
eval_classconstructs methods, accessors, fields, brands, and deferred initializers. - Preserve the enclosing private environment for heritage and nested classes, class-name TDZ, strictness, source-order/once-only
ToPropertyKey, suspension, abrupt completion, OOM cleanup, moving GC, and no-GIL ownership. - Preserve closures created during a computed-name expression: a closure capturing
#namemust retain the same private identity later installed on instances of that one class evaluation.
Acceptance
- Statement/expression class Test262 visibility cases for private fields, methods, and accessors pass in required bytecode with zero fallback.
- Paired tree-walker/required witnesses cover get, set, update, call,
#name in, direct eval, nested/outer private shadowing, repeated class evaluation, and a closure escaping a computed-name expression. - Heritage still resolves only the enclosing private environment; computed names resolve the new class environment.
- Generator/async suspension, actual moving-GC, allocation-failure replay, no-GIL/TSan, full unit, and relevant Test262 gates pass.
- Exact-parent admission gains/regressions are reported and the implementation commit/CI are linked.
No compile-time private-name identity, duplicate per-phase identities, public-property lowering, source rewrite, disabled collection, suppressed failure, or tree-walker fallback counted as completion.