Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions plugins/axiomcode/skills/axiomcode/scripts/axiomcode-path
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,16 @@ def path(g, a, b, show_all=False, limit=10, every=False, max_paths=20):
m, d = hits[0]; chain = read_back(res['parent_opt'], q, m, srcs)
if not chain: continue
bridges = [(chain[i][0], chain[i + 1][0]) for i in range(len(chain) - 1) if chain[i + 1][1] == 'by-name']
# A bridge whose every site calls a VALUE (a field, a variable, a parameter) is not a receiver that lacks a
# type: what it holds decides the callee, and the value-callee report below says so and names the site.
if bridges and g.has('ext_unresolved_value_callee') and all(
g.q("SELECT 1 FROM call_sites s JOIN unresolved_sites u ON u.call_site_id = s.id WHERE s.caller_id = ?"
" AND s.callee_name = ? LIMIT 1", c, g.sym[m2]['name'])
and not g.q("SELECT 1 FROM call_sites s JOIN unresolved_sites u ON u.call_site_id = s.id"
" WHERE s.caller_id = ? AND s.callee_name = ?"
" AND s.id NOT IN (SELECT c0 FROM ext_unresolved_value_callee) LIMIT 1", c, g.sym[m2]['name'])
for c, m2 in bridges):
continue
print(f" {word} WOULD connect in {d} hop(s) if {len(bridges)} unresolved call(s) resolve the way their name suggests — look at:")
for c, m2 in bridges:
sites = g.q("SELECT s.file_path f, s.start_line ln FROM call_sites s JOIN unresolved_sites u ON u.call_site_id = s.id WHERE s.caller_id = ? AND s.callee_name = ?", c, g.sym[m2]['name'])
Expand Down
4 changes: 2 additions & 2 deletions tests/cases/javascript/stored-field-callee-shapes/case.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
"Store.find"
],
"want": [
"→ [multi_inferred · call @ src/shapes.js:44] Store.find"
"→ [known_edge · call @ src/shapes.js:44] Store.find"
],
"avoid": [
"the two are independent in this graph"
Expand All @@ -255,7 +255,7 @@
"Store.find"
],
"want": [
"→ [multi_inferred · call @ src/shapes.js:45] Store.find"
"→ [known_edge · call @ src/shapes.js:45] Store.find"
],
"avoid": []
},
Expand Down
Loading