From 64fa746b4369855977c9fa22268b687189dcf856 Mon Sep 17 00:00:00 2001 From: ayushcodes10 Date: Wed, 16 Sep 2026 23:01:39 +0530 Subject: [PATCH] Wire the second chance lookup into the scoped call branch Only the Foo colon colon bar branch tags a fallback label, since it is the only one with a class name in source to build one from. The lookup only runs when the primary method index lookup already came back empty, and only accepts an exactly one candidate match, the same guard every other resolver in this module already applies. Co-Authored-By: Claude Sonnet 5 (cherry picked from commit b5e066c7d40738fe5c5bb7f5e8b592ebbd27b431) --- graphify/extract.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/graphify/extract.py b/graphify/extract.py index 56c02dcf9..b23d1b65d 100644 --- a/graphify/extract.py +++ b/graphify/extract.py @@ -3830,6 +3830,7 @@ def _resolve_cpp_member_calls( if rc.get("lang") != "cpp": continue # Determine the receiver's type and the resulting confidence. + qualified_fallback_label: str | None = None if receiver == "this": # this->bar(): receiver is the caller's own enclosing class. type_nid = enclosing_type.get(caller) @@ -3838,6 +3839,7 @@ def _resolve_cpp_member_calls( type_qualified = True elif receiver[:1].isupper(): # Foo::bar(): the type is named explicitly in source. + qualified_fallback_label = f"{receiver}::{callee}()" type_defs = type_def_nids.get(_key(receiver), []) if not type_defs: # Declared nowhere here, which in a multi-repo setup usually means @@ -3869,6 +3871,10 @@ def _resolve_cpp_member_calls( type_nid = type_defs[0] type_qualified = False method_nid = method_index.get((type_nid, _key(callee))) + if method_nid is None and qualified_fallback_label is not None: + candidates = qualified_method_nids.get(qualified_fallback_label, []) + if len(candidates) == 1: + method_nid = candidates[0] target = method_nid or type_nid relation = "calls" if method_nid else "references" if target == caller or (caller, target) in existing_pairs: