mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
A constructor that let other code read a field before assigning it (a base constructor calling an override, or the constructor calling its own method) read an empty slot, which crashed the executable for string fields. Node reads undefined. Fields assigned after construction can expose the instance now admit undefined. Allocation writes undefined into them. String, number, boolean, bigint and union fields read as runtime-optional values, and class, array, record and collection fields use the deferred-init reads, whose member access throws a TypeError. Classes whose construction cannot expose the instance before their assignments keep their layouts.