mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-29 07:04:09 +08:00
A class instance keeps its own dynamic properties in a lazily created bag (`%dynProperties`). Untyped reads went through the bag accessor that creates and stores the bag on first use: selecting a method checks the bag for an own property shadowing it, and the named and computed fallbacks, `in`/own probes, Reflect.get, for-in and accessor reads all looked their key up there. So a pure read stored into the object. On a published object the frozen-object guard rejects that store with "Cannot assign to read only property '%dynProperties'", where Node reads without error. Read-only bag accessors now never store. The untyped %dyn.class.readProperties is rebuilt from the settled bag dispatch without its lazy stores, and typed read helpers return a prototype-backed bag instead of storing it. Every read path uses the read-only accessor: key tests treat an absent bag as having no own keys, and lookups that must see Object.prototype read from a fresh, unstored empty object. Writes keep the storing accessor. Found with tsc-ts at --checkers 8 on vercel/eve: a checker thread read `host.commonSourceDirectory()` through an untyped interface value whose object is the published Program.