mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
A reference field that only its class family's constructors write, through their own `this`, never changes outside them. While its object is held, the field's value is held too, so `this.scanner.scan()` and `const units = this.units` need no retain and release (and no collector buffering on the release). analyzeFinalFields finds such fields over the whole program. It looks through the derived constructor's guards on `this`, and disqualifies fields that live dynamic views can store into (the detection int32 slots already uses, now shared as dynamicFieldStores), fields of runtime-provided or generic classes, and every field in library builds. canBorrowCallArgument accepts a final field of a borrowable object, except in constructors, async functions and generators, and except for nullable-pointer fields, which have no box to lend.