This repository was archived by the owner on Sep 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +14
-7
lines changed
languages/tree-sitter-stack-graphs-typescript/rust
tree-sitter-stack-graphs/src Expand file tree Collapse file tree 4 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ impl FileAnalyzer for TsConfigAnalyzer {
2121 _file : Handle < File > ,
2222 _path : & Path ,
2323 _source : & ' a str ,
24+ _paths : Vec < & Path > ,
2425 _cancellation_flag : & ' a dyn tree_sitter_stack_graphs:: CancellationFlag ,
2526 ) -> Result < ( ) , tree_sitter_stack_graphs:: LoadError > {
2627 todo ! ( )
Original file line number Diff line number Diff line change @@ -209,23 +209,25 @@ impl TestArgs {
209209 . with_context ( || format ! ( "Loading builtins into {}" , test_path. display( ) ) ) ?;
210210 let mut globals = Variables :: new ( ) ;
211211 for test_fragment in & test. fragments {
212- let fragment_path = Path :: new ( test. graph [ test_fragment. file ] . name ( ) ) . to_path_buf ( ) ;
213- if let Some ( fa) = fragment_path
212+ let all_paths = test. fragments . iter ( ) . map ( |f| f. path . as_path ( ) ) . collect ( ) ;
213+ if let Some ( fa) = test_fragment
214+ . path
214215 . file_name ( )
215216 . and_then ( |f| lc. special_files . get ( & f. to_string_lossy ( ) ) )
216217 {
217218 fa. build_stack_graph_into (
218219 & mut test. graph ,
219220 test_fragment. file ,
220- & fragment_path ,
221+ & test_fragment . path ,
221222 & test_fragment. source ,
223+ all_paths,
222224 & NoCancellation ,
223225 ) ?;
224- } else if lc. matches_file ( & fragment_path , Some ( & test_fragment. source ) ) {
226+ } else if lc. matches_file ( & test_fragment . path , Some ( & test_fragment. source ) ) {
225227 globals. clear ( ) ;
226228 test_fragment. add_globals_to ( & mut globals) ;
227229 self . build_fragment_stack_graph_into (
228- & fragment_path ,
230+ & test_fragment . path ,
229231 & lc. sgl ,
230232 test_fragment. file ,
231233 & test_fragment. source ,
@@ -235,8 +237,8 @@ impl TestArgs {
235237 } else {
236238 return Err ( anyhow ! (
237239 "Test fragment {} not supported by language of test file {}" ,
238- fragment_path . display( ) ,
239- test_path . display( )
240+ test_fragment . path . display( ) ,
241+ test . path . display( )
240242 ) ) ;
241243 }
242244 }
Original file line number Diff line number Diff line change @@ -945,6 +945,7 @@ pub trait FileAnalyzer {
945945 file : Handle < File > ,
946946 path : & Path ,
947947 source : & ' a str ,
948+ paths : Vec < & Path > ,
948949 cancellation_flag : & ' a dyn CancellationFlag ,
949950 ) -> Result < ( ) , LoadError > ;
950951}
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ pub struct Test {
126126#[ derive( Debug , Clone ) ]
127127pub struct TestFragment {
128128 pub file : Handle < File > ,
129+ pub path : PathBuf ,
129130 pub source : String ,
130131 pub assertions : Vec < Assertion > ,
131132 pub globals : HashMap < String , String > ,
@@ -167,6 +168,7 @@ impl Test {
167168 . for_each ( |_| line_files. push ( Some ( file) ) ) ;
168169 fragments. push ( TestFragment {
169170 file,
171+ path : current_path,
170172 source : current_source,
171173 assertions : Vec :: new ( ) ,
172174 globals : current_globals,
@@ -206,6 +208,7 @@ impl Test {
206208 ( line_files. len ( ) ..line_count) . for_each ( |_| line_files. push ( Some ( file) ) ) ;
207209 fragments. push ( TestFragment {
208210 file,
211+ path : current_path,
209212 source : current_source,
210213 assertions : Vec :: new ( ) ,
211214 globals : current_globals,
You can’t perform that action at this time.
0 commit comments