mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-19 10:21:34 +00:00
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 <noreply@anthropic.com>
(cherry picked from commit b5e066c7d4)
This commit is contained in:
1 parent
835abadf7a
commit
64fa746b43
1 file changed
+6
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user