Skip to content

Commit 79d0a0f

Browse files
committed
Cleanup, move Update type in lib
1 parent 0c940d1 commit 79d0a0f

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

crates/compilers/src/flatten.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
filter::MaybeSolData,
44
replace_source_content,
55
resolver::parse::SolData,
6-
ArtifactOutput, CompilerSettings, Graph, Project, ProjectPathsConfig,
6+
ArtifactOutput, CompilerSettings, Graph, Project, ProjectPathsConfig, Updates,
77
};
88
use foundry_compilers_artifacts::{
99
ast::{visitor::Visitor, *},
@@ -18,7 +18,7 @@ use foundry_compilers_core::{
1818
};
1919
use itertools::Itertools;
2020
use std::{
21-
collections::{BTreeSet, HashMap, HashSet},
21+
collections::{HashMap, HashSet},
2222
hash::Hash,
2323
path::{Path, PathBuf},
2424
sync::Arc,
@@ -112,11 +112,6 @@ impl Visitor for ReferencesCollector {
112112
}
113113
}
114114

115-
pub type Update = (usize, usize, String);
116-
/// Updates to be applied to the sources.
117-
/// source_path -> (start, end, new_value)
118-
pub type Updates = HashMap<PathBuf, BTreeSet<(usize, usize, String)>>;
119-
120115
pub struct FlatteningResult {
121116
/// Updated source in the order they should be written to the output file.
122117
sources: Vec<String>,

crates/compilers/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,18 @@ pub use filter::{FileFilter, SparseOutputFilter, TestFileFilter};
4040

4141
pub mod report;
4242

43+
/// Updates to be applied to the sources.
44+
/// source_path -> (start, end, new_value)
45+
pub type Update = (usize, usize, String);
46+
pub type Updates = HashMap<PathBuf, BTreeSet<Update>>;
47+
4348
/// Utilities for creating, mocking and testing of (temporary) projects
4449
#[cfg(feature = "project-util")]
4550
pub mod project_util;
4651

4752
pub use foundry_compilers_artifacts as artifacts;
4853
pub use foundry_compilers_core::{error, utils};
4954

50-
use crate::flatten::Update;
5155
use cache::CompilerCache;
5256
use compile::output::contracts::VersionedContracts;
5357
use compilers::multi::MultiCompiler;
@@ -64,7 +68,7 @@ use project::ProjectCompiler;
6468
use semver::Version;
6569
use solc::SolcSettings;
6670
use std::{
67-
collections::{BTreeMap, HashMap, HashSet},
71+
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
6872
path::{Path, PathBuf},
6973
};
7074

crates/compilers/src/preprocessor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use super::project::Preprocessor;
22
use crate::{
3-
flatten::{apply_updates, Updates},
3+
flatten::apply_updates,
44
multi::{MultiCompiler, MultiCompilerInput, MultiCompilerLanguage},
55
replace_source_content,
66
solc::{SolcCompiler, SolcVersionedInput},
7-
Compiler, ProjectPathsConfig, Result, SolcError,
7+
Compiler, ProjectPathsConfig, Result, SolcError, Updates,
88
};
99
use alloy_primitives::hex;
1010
use foundry_compilers_artifacts::{

0 commit comments

Comments
 (0)