Skip to content

Commit 15ec56f

Browse files
committed
Bump solar rev
1 parent c4ec52c commit 15ec56f

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ tokio = { version = "1.35", features = ["rt-multi-thread"] }
7070
snapbox = "0.6.9"
7171

7272
[patch.crates-io]
73-
solar-parse = { git = "https://github.com/paradigmxyz/solar", rev = "964b054" }
74-
solar-sema = { git = "https://github.com/paradigmxyz/solar", rev = "964b054" }
73+
solar-parse = { git = "https://github.com/paradigmxyz/solar", rev = "77fb82b" }
74+
solar-sema = { git = "https://github.com/paradigmxyz/solar", rev = "77fb82b" }
7575

crates/compilers/src/preprocessor/mod.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ use solar_parse::{
2222
},
2323
Parser,
2424
};
25-
use solar_sema::{hir::Arena, ParsingContext};
25+
use solar_sema::ParsingContext;
2626
use std::{
2727
collections::HashSet,
2828
path::{Path, PathBuf},
2929
};
30+
use solar_sema::thread_local::ThreadLocal;
3031

3132
mod data;
3233
mod deps;
@@ -74,7 +75,6 @@ impl Preprocessor<SolcCompiler> for TestOptimizerPreprocessor {
7475

7576
let sess = Session::builder().with_buffer_emitter(Default::default()).build();
7677
let _ = sess.enter_parallel(|| -> solar_parse::interface::Result {
77-
let hir_arena = Arena::new();
7878
let mut parsing_context = ParsingContext::new(&sess);
7979
// Set remappings into HIR parsing context.
8080
for remapping in &paths.remappings {
@@ -93,24 +93,27 @@ impl Preprocessor<SolcCompiler> for TestOptimizerPreprocessor {
9393
.collect_vec();
9494
parsing_context.load_files(&preprocessed_paths)?;
9595

96-
let hir = &parsing_context.parse_and_lower_to_hir(&hir_arena)?;
97-
// Collect tests and scripts dependencies and identify mock contracts.
98-
let deps = PreprocessorDependencies::new(
99-
&sess,
100-
hir,
101-
&preprocessed_paths,
102-
&paths.paths_relative().sources,
103-
&paths.root,
104-
mocks,
105-
);
106-
// Collect data of source contracts referenced in tests and scripts.
107-
let data = collect_preprocessor_data(&sess, hir, &deps.referenced_contracts);
96+
let hir_arena = ThreadLocal::new();
97+
if let Some(gcx) = parsing_context.parse_and_lower(&hir_arena)? {
98+
let hir = &gcx.get().hir;
99+
// Collect tests and scripts dependencies and identify mock contracts.
100+
let deps = PreprocessorDependencies::new(
101+
&sess,
102+
hir,
103+
&preprocessed_paths,
104+
&paths.paths_relative().sources,
105+
&paths.root,
106+
mocks,
107+
);
108+
// Collect data of source contracts referenced in tests and scripts.
109+
let data = collect_preprocessor_data(&sess, hir, &deps.referenced_contracts);
108110

109-
// Extend existing sources with preprocessor deploy helper sources.
110-
sources.extend(create_deploy_helpers(&data));
111+
// Extend existing sources with preprocessor deploy helper sources.
112+
sources.extend(create_deploy_helpers(&data));
111113

112-
// Generate and apply preprocessor source updates.
113-
apply_updates(sources, remove_bytecode_dependencies(hir, &deps, &data));
114+
// Generate and apply preprocessor source updates.
115+
apply_updates(sources, remove_bytecode_dependencies(hir, &deps, &data));
116+
}
114117

115118
Ok(())
116119
});

0 commit comments

Comments
 (0)