fix(extraction): never fabricate an edge from a call-result receiver (#1748)
A member call whose receiver is itself a call — `d.setdefault(k, []).append(v)`, `make().run()` — used to drop the receiver at extraction time, degrade to the bare method name, and exact-match any top-level project symbol of that name (Python and JavaScript/TypeScript). Keep the inner callee encoded as `<inner>().<method>` in the TS extractor and native kernel; the name-matcher refuses to guess for that shape (store-accessor exception only). Based on #1692, rebased onto main after #1746. Fixes #1683. Co-authored-by: Colby McHenry <colbymchenry@users.noreply.github.com>
This commit is contained in:
co-authored by
Colby McHenry
parent
bffd50e4f1
commit
bb1d3093eb
@@ -974,6 +974,19 @@ export class ReferenceResolver {
|
||||
if (fwEarly) return fwEarly;
|
||||
|
||||
// Strategy 2: Try import-based resolution
|
||||
// A TS/JS/Python call-receiver chain (`useStore.getState().reset`, #1683)
|
||||
// names the ROOT's import, not the method's: letting resolveViaImport see
|
||||
// it binds the call to the imported store constant and the method is
|
||||
// never looked up. The name-matcher owns the chain shape for these
|
||||
// languages — the Java/Kotlin/C++ chains keep their existing path.
|
||||
if (
|
||||
ref.referenceKind === 'calls' &&
|
||||
CHAIN_SHAPE.test(ref.referenceName) &&
|
||||
(ref.language === 'typescript' || ref.language === 'javascript' || ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'python')
|
||||
) {
|
||||
return this.gateLanguage(matchReference(ref, this.context), ref);
|
||||
}
|
||||
|
||||
const tImp = this.profileStages ? process.hrtime.bigint() : 0n;
|
||||
const importResult = this.gateLanguage(resolveViaImport(ref, this.context), ref);
|
||||
if (this.profileStages) this.stageAdd('viaImport', ref, !!importResult, tImp);
|
||||
|
||||
Reference in New Issue
Block a user