You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Anonymous function-body class expression: its outer binding inside its own members resolves to the shared template (C.tag, constructor === C, C.prototype writes) #11153
Inside the members of an anonymous class expression in a function body, the outer binding name (C in const C = class { … }) resolves to the shared class template. In Node it resolves to the class object that this evaluation produced. For a class that gets a separate class object per evaluation (ClassExprFresh), this means:
C.tag reads the template's static, not this evaluation's;
this.constructor === C is false;
C.prototype.x = v inside a method writes to the template (shared by every evaluation).
A named class expression (class C { … }) is not affected, because its inner self-binding already resolves to the evaluation.
Prototype-write variant: a static init() { C.prototype.z = v } / set() { C.prototype.q = v } pair called once per evaluation prints ["z","q"] 1 2 1 2 true in Node and [] 2 2 2 2 false in Perry. This happens both on main and with #11143: the member body is lowered before the outer binding exists, so C is ClassRef(template) and the write becomes a template-keyed RegisterPrototypeMethod.
Found while verifying a CodeRabbit comment on #11143.
Activity
fix(hir): capture anonymous class outer bindings (#11153)