Files
scriptc/packages
Chris Tate dd6b8d4ad9 Read unassigned class fields as undefined during construction
Class-typed fields that construction may read before assigning them now
observe undefined instead of reading an empty slot. A small analysis walks
field initializers and the constructor in evaluation order and stops at the
first point that can hand the instance to other code (a method call, an
argument, a callback, a base constructor that does); private helpers that
only assign fields are followed. Fields not assigned by then take the
deferred-init representation:

- the slot starts empty and reads check it inline, so assigned reads stay
  borrowed and only an empty slot reaches the throw;
- equality, `typeof`, truthiness, `== null`, optional chaining, `as`
  casts, undefined-admitting destinations and console output observe the
  undefined itself;
- member reads, method calls, updates and writes through an unassigned
  field throw Node's TypeErrors in Node's evaluation order.

Fields assigned before any exposure keep their plain representation.
Definite-assignment-asserted fields assigned through such private helpers
no longer need the deferred form either.

Corpus 4471 pins inheritance, callbacks, initializer order, private helpers
and member updates; unit tests cover the analysis and the emitted checks.
2026-10-09 14:27:41 -05:00
..
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00
2026-10-08 21:18:31 -05:00