mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-26 00:37:58 +00:00
factor out solc JSON interface crate (#264)
The differential testing framework will make a second consumer. There seems to be no re-usable Rust crate for this. But we already have everything here, just needs a small refactor to make it fully re-usable. - Mostly decouple the solc JSON-input-output interface types from the `solidity` frontend crate - Expose the JSON-input-output interface types in a dedicated crate --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
pub mod size_level;
|
||||
|
||||
use revive_solc_json_interface::SolcStandardJsonInputSettingsOptimizer;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -226,3 +227,18 @@ impl std::fmt::Display for Settings {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&SolcStandardJsonInputSettingsOptimizer> for Settings {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
fn try_from(value: &SolcStandardJsonInputSettingsOptimizer) -> Result<Self, Self::Error> {
|
||||
let mut result = match value.mode {
|
||||
Some(mode) => Self::try_from_cli(mode)?,
|
||||
None => Self::cycles(),
|
||||
};
|
||||
if value.fallback_to_optimizing_for_size.unwrap_or_default() {
|
||||
result.enable_fallback_to_size();
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user