Skip to content

Commit d2b55b6

Browse files
committed
fix(resolver): add empty-string guard to Rust caller_name check for accessor this-dispatch (#1351)
Parity with the TypeScript guard: `callerName && !callerName.includes('.')`. When caller_name is empty the key would be ':this' which is never seeded, so no incorrect edge is produced today — but adding the guard removes the latent risk and makes the two engines explicitly equivalent.
1 parent f5c6279 commit d2b55b6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/codegraph-core/src/edge_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ fn resolve_call_targets<'a>(
439439
// accessor for `obj`, typeMap seeds 'callerName:this' = 'obj'. Resolve this.method()
440440
// via typeMap['obj.method'] → the concrete definition. Runs before the broad exact-name
441441
// lookup to avoid false positives from unrelated same-file definitions.
442-
if call.receiver.as_deref() == Some("this") && !caller_name.contains('.') {
442+
if call.receiver.as_deref() == Some("this") && !caller_name.is_empty() && !caller_name.contains('.') {
443443
let accessor_key = format!("{}:this", caller_name);
444444
if let Some(&(obj_name, _)) = type_map.get(accessor_key.as_str()) {
445445
let obj_method_key = format!("{}.{}", obj_name, call.name);

0 commit comments

Comments
 (0)