Land the six-file fix from upstream PR #1691 by danusha2345 (pr-1691 at 6d0e80d52ae953b22d615bd20c4a4c7758814e60), preserving wasm/native extraction parity and exclusive field-type resolution. Preserve coexistence with the #1566 Map/collection fix merged in #1790, including nested holder.values.get coverage and the unchanged #1566 Unreleased changelog bullet. EXTRACTION_VERSION remains unchanged. Align the existing chained-receiver regression with the fix: a declared service field calls its method, while an anonymous field type does not bind to unrelated same-named project functions. Verified on Linux with Node 22.19.0: - Rebuilt the native kernel and TypeScript/browser distribution. - Both backends change Outbox::send -> Outbox::send into Outbox::send -> Mailer::send, keep Relay::forward -> Mailer::send, and store no self-edges in the issue repro. - Wasm: 224 tests passed; native kernel: 255 tests passed, no skips. - All 10 #1566 resolution cases pass on each backend, plus all four nested-receiver extraction parity cases. Co-authored-by: Colby McHenry <colbymchenry@users.noreply.github.com>
This commit is contained in:
co-authored by
Colby McHenry
parent
de5adba7ea
commit
cece0720e3
@@ -4728,6 +4728,29 @@ export class TreeSitterExtractor {
|
||||
// scope keywords: such calls previously emitted a bare method
|
||||
// name, which either failed to resolve or resolved ambiguously.
|
||||
calleeName = `${getNodeText(receiver, this.source)}.${methodName}`;
|
||||
} else if (
|
||||
(this.language === 'typescript' ||
|
||||
this.language === 'javascript' ||
|
||||
this.language === 'tsx' ||
|
||||
this.language === 'jsx') &&
|
||||
receiver &&
|
||||
receiver.type === 'member_expression' &&
|
||||
getChildByField(receiver, 'object')?.type === 'this' &&
|
||||
getChildByField(receiver, 'property')?.type === 'property_identifier'
|
||||
) {
|
||||
// TS/JS call through a field of the enclosing class —
|
||||
// `this.mailer.send()` (#1496). Keep the `this.<field>` prefix:
|
||||
// the resolver reads the field's declared type off the class's
|
||||
// own declaration (`private mailer: Mailer`, `mailer = new
|
||||
// Mailer()`) and resolves the method on THAT type — or leaves the
|
||||
// ref unresolved when the type is external or unknown. Previously
|
||||
// this collapsed to the bare method name, which exact-matched
|
||||
// whichever same-named method was nearest — the calling method
|
||||
// itself when the two share a name, a self-edge not in the
|
||||
// source. Same discipline as Rust's `self.<field>` (#1585).
|
||||
// Mirrored in the kernel's extract_call (tsjs/extractors.rs).
|
||||
const fieldName = getNodeText(getChildByField(receiver, 'property')!, this.source);
|
||||
calleeName = `this.${fieldName}.${methodName}`;
|
||||
} else if (
|
||||
(this.language === 'typescript' ||
|
||||
this.language === 'javascript' ||
|
||||
|
||||
Reference in New Issue
Block a user