File tree Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,10 @@ pub trait SourceParser: Clone + Debug + Send + Sync {
166166 } )
167167 . collect :: < Result < _ > > ( )
168168 }
169+
170+ fn finalize_imports ( & mut self , _include_paths : & BTreeSet < PathBuf > ) -> Result < ( ) > {
171+ Ok ( ( ) )
172+ }
169173}
170174
171175/// Parser of the source files which is used to identify imports and version requirements of the
Original file line number Diff line number Diff line change @@ -412,6 +412,12 @@ impl SourceParser for MultiCompilerParser {
412412 )
413413 . collect ( ) )
414414 }
415+
416+ fn finalize_imports ( & mut self , include_paths : & BTreeSet < PathBuf > ) -> Result < ( ) > {
417+ self . solc . finalize_imports ( include_paths) ?;
418+ self . vyper . finalize_imports ( include_paths) ?;
419+ Ok ( ( ) )
420+ }
415421}
416422
417423impl ParsedSource for MultiCompilerParsedSource {
Original file line number Diff line number Diff line change @@ -401,6 +401,7 @@ impl SourceParser for SolParser {
401401 ) -> Result < Vec < ( PathBuf , Node < Self :: ParsedSource > ) > > {
402402 self . compiler_mut ( ) . enter_mut ( |compiler| {
403403 let mut pcx = compiler. parse ( ) ;
404+ pcx. set_resolve_imports ( false ) ;
404405 let files = sources
405406 . par_iter ( )
406407 . map ( |( path, source) | {
@@ -447,6 +448,16 @@ impl SourceParser for SolParser {
447448 Ok ( parsed)
448449 } )
449450 }
451+
452+ fn finalize_imports ( & mut self , include_paths : & BTreeSet < PathBuf > ) -> Result < ( ) > {
453+ self . compiler_mut ( ) . sess_mut ( ) . opts . include_paths . extend ( include_paths. iter ( ) . cloned ( ) ) ;
454+ self . compiler_mut ( ) . enter_mut ( |compiler| {
455+ let mut pcx = compiler. parse ( ) ;
456+ pcx. set_resolve_imports ( true ) ;
457+ pcx. force_resolve_all_imports ( ) ;
458+ } ) ;
459+ Ok ( ( ) )
460+ }
450461}
451462
452463impl ParsedSource for SolData {
Original file line number Diff line number Diff line change @@ -484,6 +484,8 @@ impl<P: SourceParser> Graph<P> {
484484 ) ;
485485 }
486486
487+ parser. finalize_imports ( & resolved_solc_include_paths) ?;
488+
487489 let edges = GraphEdges {
488490 edges,
489491 rev_edges,
You can’t perform that action at this time.
0 commit comments