Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit ac2a19a

Browse files
committed
Add failing test for guarding against 'import' def results across files
1 parent 03872bd commit ac2a19a

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

languages/tree-sitter-stack-graphs-java/src/stack-graphs.tsg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ attribute node_symbol = node => symbol = (source-text node), source_n
3434
; # # # #### #### # # # # # # ####
3535
;
3636
; ########################################################
37+
(program)@prog {
38+
scan FILE_PATH {
39+
"([^/]+)\.java$" {
40+
; FIXME add definitions
41+
42+
}
43+
}
44+
45+
}
3746

3847
(program)@prog {
3948
node @prog.defs
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*--- path: a.java ---*/
2+
import foo.bar.Baz;
3+
4+
public class Importer {
5+
public static void main(String[] args) {
6+
Baz.some_method();
7+
// ^ defined: 2
8+
}
9+
}
10+
11+
12+
/* --- path: b.java ---*/
13+
14+
import foo.bar.Baz;
15+
16+
public class AnotherImporter {
17+
public static void main(String[] args) {
18+
Baz.some_method();
19+
}
20+
}

0 commit comments

Comments
 (0)