@@ -15,15 +15,16 @@ use foundry_compilers::{
1515} ;
1616use foundry_config:: Config ;
1717use itertools:: Itertools ;
18- use solar_ast:: {
19- ast:: { self , Arena , FunctionKind , Span , VarMut } ,
20- interface:: source_map:: FileName ,
21- visit:: Visit ,
18+ use rayon:: prelude:: * ;
19+ use solar_parse:: {
20+ ast:: { self , interface:: source_map:: FileName , visit:: Visit , Arena , FunctionKind , Span , VarMut } ,
21+ interface:: Session ,
22+ Parser as SolarParser ,
2223} ;
23- use solar_parse:: { interface:: Session , Parser as SolarParser } ;
2424use std:: {
2525 collections:: { BTreeMap , BTreeSet } ,
2626 fmt:: { self , Write } ,
27+ ops:: ControlFlow ,
2728 path:: PathBuf ,
2829 sync:: Arc ,
2930} ;
@@ -89,9 +90,8 @@ impl BindJsonArgs {
8990 . 1 ;
9091
9192 let sess = Session :: builder ( ) . with_stderr_emitter ( ) . build ( ) ;
92- let result = sess. enter ( || -> solar_parse:: interface:: Result < ( ) > {
93- // TODO: Switch back to par_iter_mut and `enter_parallel` after solar update.
94- sources. 0 . iter_mut ( ) . try_for_each ( |( path, source) | {
93+ let result = sess. enter_parallel ( || -> solar_parse:: interface:: Result < ( ) > {
94+ sources. 0 . par_iter_mut ( ) . try_for_each ( |( path, source) | {
9595 let mut content = Arc :: try_unwrap ( std:: mem:: take ( & mut source. content ) ) . unwrap ( ) ;
9696
9797 let arena = Arena :: new ( ) ;
@@ -153,7 +153,12 @@ impl PreprocessorVisitor {
153153}
154154
155155impl < ' ast > Visit < ' ast > for PreprocessorVisitor {
156- fn visit_item_function ( & mut self , func : & ' ast ast:: ItemFunction < ' ast > ) {
156+ type BreakValue = solar_parse:: interface:: data_structures:: Never ;
157+
158+ fn visit_item_function (
159+ & mut self ,
160+ func : & ' ast ast:: ItemFunction < ' ast > ,
161+ ) -> ControlFlow < Self :: BreakValue > {
157162 // Replace function bodies with a noop statement.
158163 if let Some ( block) = & func. body {
159164 if !block. is_empty ( ) {
@@ -169,7 +174,10 @@ impl<'ast> Visit<'ast> for PreprocessorVisitor {
169174 self . walk_item_function ( func)
170175 }
171176
172- fn visit_variable_definition ( & mut self , var : & ' ast ast:: VariableDefinition < ' ast > ) {
177+ fn visit_variable_definition (
178+ & mut self ,
179+ var : & ' ast ast:: VariableDefinition < ' ast > ,
180+ ) -> ControlFlow < Self :: BreakValue > {
173181 // Remove `immutable` attributes.
174182 if let Some ( VarMut :: Immutable ) = var. mutability {
175183 self . updates . push ( ( var. span , "" ) ) ;
0 commit comments