mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-25 10:37:57 +00:00
94ec34c4d5
Separate between compilation and linker phases to allow deploy time linking and back-porting era compiler changes to fix #91. Unlinked contract binaries (caused by missing libraries or missing factory dependencies in turn) are emitted as raw ELF object. Few drive by fixes: - #98 - A compiler panic on missing libraries definitions. - Fixes some incosistent type forwarding in JSON output (empty string vs. null object). - Remove the unused fallback for size optimization setting. - Remove the broken `--lvm-ir` mode. - CI workflow fixes. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com> Signed-off-by: xermicus <bigcyrill@hotmail.com> Signed-off-by: xermicus <cyrill@parity.io>
43 lines
1.3 KiB
Rust
43 lines
1.3 KiB
Rust
//! The missing Solidity libraries.
|
|
|
|
use std::collections::BTreeMap;
|
|
use std::collections::BTreeSet;
|
|
|
|
use revive_solc_json_interface::SolcStandardJsonOutput;
|
|
|
|
use crate::solc::version::Version as SolcVersion;
|
|
|
|
/// The missing Solidity libraries.
|
|
pub struct MissingLibraries {
|
|
/// The missing libraries.
|
|
pub contract_libraries: BTreeMap<String, BTreeSet<String>>,
|
|
}
|
|
|
|
impl MissingLibraries {
|
|
/// A shortcut constructor.
|
|
pub fn new(contract_libraries: BTreeMap<String, BTreeSet<String>>) -> Self {
|
|
Self { contract_libraries }
|
|
}
|
|
|
|
/// Writes the missing libraries to the standard JSON.
|
|
pub fn write_to_standard_json(
|
|
mut self,
|
|
standard_json: &mut SolcStandardJsonOutput,
|
|
solc_version: &SolcVersion,
|
|
) {
|
|
for (path, file) in standard_json.contracts.iter_mut() {
|
|
for (name, contract) in file.iter_mut() {
|
|
let full_name = format!("{path}:{name}");
|
|
let missing_libraries = self.contract_libraries.remove(full_name.as_str());
|
|
|
|
if let Some(missing_libraries) = missing_libraries {
|
|
contract.missing_libraries = missing_libraries;
|
|
}
|
|
}
|
|
}
|
|
|
|
standard_json.version = Some(solc_version.default.to_string());
|
|
standard_json.long_version = Some(solc_version.long.to_owned());
|
|
}
|
|
}
|