add fn settings on CompilerInput (#729)

This commit is contained in:
joshieDo 2021-12-23 17:03:37 +02:00 committed by GitHub
parent 07e13ab9c7
commit ade8cd9553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -39,6 +39,13 @@ impl CompilerInput {
Self { language: "Solidity".to_string(), sources, settings: Default::default() }
}
/// Sets the settings for compilation
#[must_use]
pub fn settings(mut self, settings: Settings) -> Self {
self.settings = settings;
self
}
/// Sets the EVM version for compilation
#[must_use]
pub fn evm_version(mut self, version: EvmVersion) -> Self {

View File

@ -335,6 +335,7 @@ impl<Artifacts: ArtifactOutput> Project<Artifacts> {
paths.extend(map);
let input = CompilerInput::with_sources(sources)
.settings(self.solc_config.settings.clone())
.normalize_evm_version(&solc.version()?)
.with_remappings(self.paths.remappings.clone());
@ -397,7 +398,7 @@ impl<Artifacts: ArtifactOutput> Project<Artifacts> {
let sources = paths.set_source_names(sources);
let input = CompilerInput::with_sources(sources)
.evm_version(self.solc_config.settings.evm_version.unwrap_or_default())
.settings(self.solc_config.settings.clone())
.normalize_evm_version(&solc.version()?)
.with_remappings(self.paths.remappings.clone());