| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…e registry (#2086) collectLocalAccessors/collect_local_accessors keyed a same-file get/set accessor registry purely by ClassName.propName, with no static/instance distinction. this inside an instance method never refers to the class/constructor object (where static members live) — only this inside a static method does — so a class declaring only a static accessor of a given name could produce a false calls edge for an unrelated instance method's this.prop read (and the mirror case, an instance-only accessor read from a static method, had the same gap in reverse). LocalAccessorInfo now tracks static get/set separately from instance get/set, and a new isEnclosingMethodStatic walk determines which bucket a this.prop read's calling context should match against. The varName.prop (non-this) branch is unaffected: it already only ever needs the instance bucket, since typeMap never records a variable holding the class object itself. docs check acknowledged Impact: 7 functions changed, 0 affected
Greptile SummaryThis PR separates static and instance ES6 accessor registrations so same-file property reads produce call edges only for the receiver’s applicable accessor kind.
Confidence Score: 5/5The PR appears safe to merge, with the documented static initializer and static-block limitation intentionally left outside its scope. The TypeScript and Rust implementations remain aligned, select accessor buckets consistently for supported method contexts, and add focused regression coverage without introducing an accepted defect. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Read["this.prop read/write"] --> Class["Resolve enclosing class"]
Class --> Context{"Nearest enclosing method"}
Context -->|static| Static["Match staticGet/staticSet"]
Context -->|instance| Instance["Match get/set"]
Static --> Edge{"Matching unambiguous accessor?"}
Instance --> Edge
Edge -->|yes| Call["Emit accessor call fact"]
Edge -->|no| Skip["Do not emit edge"]
Reviews (1): Last reviewed commit: "fix(extractors): distinguish static vs i..." | Re-trigger Greptile |
Sorry, something went wrong.
Codegraph Impact Analysis5 functions changed → 14 callers affected across 3 files
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Closes #2086
Deferred from #2031's review (Greptile 5/5, one open note): collectLocalAccessors/collect_local_accessors's same-file ES6 get/set accessor registry keyed purely by ClassName.propName -> {get, set}, with no static/instance distinction. this inside an instance method never refers to the class/constructor object (where static members live) — only this inside a static method does. If a class declared only a static get X() (no instance accessor of that name), a bare this.X read inside an instance method matched against the static accessor and produced a false-positive calls edge (and the mirror case — an instance-only accessor read from a static method — had the same gap in reverse):
Changes
Known narrow gap left out of scope (matches the issue's stated boundary): a class field initializer or static { } block isn't inside any method_definition, so isEnclosingMethodStatic defaults to instance-context there — a static field initializer's own this.prop read could still misclassify. Not handled here; flagged in code comments for anyone extending this further.
Test plan