Skip to content

Give repeated class evaluations fresh guest constructor identity #1964

Description

@nickna

Implement the constructor-definition representation decided by #1906: each evaluation of a class expression creates a fresh guest constructor/definition object while sharing its pre-emitted CLR template. The consolidated #1866 PR will contain docs/plans/repeated-class-evaluation.md and tests/fixtures/RepeatedClassEvaluation/.

The original #1849–#1851 notes omit their exact repeated-evaluation source/deadline. New constructors-only.ts establishes the current mismatch on unchanged 0ad37b5 and 9a431d62: Node/CLI interpretation print false; IL-verified compiled standalone prints true, exit 0. Separate syntax-node tests from #1859 still pass; they do not repair evaluation identity.

Acceptance:

  • Introduce fresh guest definition values per evaluation, retain declaration/template identity for checked compilation metadata, and associate constructed instances with the selected definition before field initialization.
  • Route observable class value equality, new/Reflect construction and required direct constructor paths through the definition; preserve name/arity, prototype/constructor identity and definition-aware instanceof.
  • Cover one syntax node evaluated twice in a function, loop, closure, module and suspended async/generator execution. Distinct definitions remain independent; CLR generic type arguments within one definition keep the same guest constructor/prototype.
  • Match Node for constructors-only and prototype identity controls in both engines and verified standalone output under 30-second deadlines. Keep existing class expression/owner/local class/generic tests passing.
  • Run affected constructor/generic/property tests, Release, quality gates and actual AOT analyzer baseline; report runtime, IL and hosted evidence separately.

Captured computed-key isolation is a separate dependent task. Stop at the definition identity/instance association boundary. Do not emit new CLR types at guest runtime, use a static "current definition", implement arbitrary dynamic heritage (#1907), or expand the frozen #1866 child list. This is a finite implementation transfer, not a claim of repaired behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions