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
Split out from #10556 while fixing new Sub() instanceof EventEmitter (PR #10592, root cause and
fix there). instanceof for a native-builtin subclass now walks the registered class-chain parent
edge, but the subclass's declared prototype object is still not identity-linked to the builtin's real .prototype object.
typeof EventEmitter.prototype does not throw and reads as "object", matching Node — so this is
narrower than "accessing EventEmitter.prototype throws"; it is specifically that Object.getPrototypeOf(Sub.prototype) does not return the same object identity as EventEmitter.prototype. instanceof, util.inherits-based prototype linking, and the class-chain
walk (all fixed by #10592) do not depend on this identity and are unaffected.
Suspected area
Native-base-class subclassing (see CLAUDE.md "Known-weak areas: Native base-class subclassing" — a
native base's surface is installed at super() time and its parent edge lives in the class registry,
which is a different mechanism than declared-class prototype-object identity). Likely needs Sub.prototype's [[Prototype]] to be set to the actual EventEmitter.prototype object at class
construction time for natively-backed builtins, not just a reserved class id for the instanceof
chain walk.
Impact
Low — spec-compliance gap for prototype introspection / mixin patterns that compare Object.getPrototypeOf identity directly, rather than using instanceof. Not currently known to break
a specific npm package.
Activity
wip(test): gap coverage for #10599 (fieldless/indirect/expr/async-res…
fix(runtime): link a native-base subclass prototype to the real built…
fix(codegen): register EventEmitterAsyncResource as a reserved extend…
test(gap): cover #10599's EventEmitter subclass prototype identity
fix(codegen): register EventEmitterAsyncResource as a reserved extend…
test(gap): cover #10599's EventEmitter subclass prototype identity
fix(runtime): link a native-base subclass prototype to the real built…
fix(hir): capture-free class expressions evaluate to distinct classes
fix(hir): capture-free class expressions evaluate to distinct classes