mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
The class method census marks a method name as replaceable when a function-typed property write uses that name, so a scanner storing its error callback in `this.onError` made every call of any class's `onError` method go through the checked property bag. That bag is a dynamic store naming any property, so the int32 slot analysis also gave up int32 storage for every class field exposed to dynamic code. A function-typed write now marks the name only when an instance of a class that has the method can inhabit the receiver's type: an assignability check against the instance types of the method's owners, with `this` in an instance member read as its class. Generic or anonymous owners, `this` outside instance members, type parameters, `any` and `unknown` receivers keep the conservative answer. Writes through interfaces or subclasses that can reach a method still replace it. Test: class-method-mutations.test.ts. Corpus: 4597-callback-field-method-name.