Files
revive/crates/resolc/src/project/contract/ir/mod.rs
T
xermicus 94ec34c4d5 Separate compilation and linker phases (#376)
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>
2025-09-27 20:52:22 +02:00

41 lines
887 B
Rust

//! The contract source code.
use std::collections::BTreeSet;
use serde::Deserialize;
use serde::Serialize;
use self::yul::Yul;
pub mod yul;
/// The contract source code.
#[derive(Debug, Serialize, Deserialize, Clone)]
#[allow(clippy::upper_case_acronyms)]
pub enum IR {
/// The Yul source code.
Yul(Yul),
}
impl IR {
/// Drains the list of factory dependencies.
pub fn drain_factory_dependencies(&mut self) -> BTreeSet<String> {
match self {
IR::Yul(ref mut yul) => yul.object.factory_dependencies.drain().collect(),
}
}
/// Get the list of missing deployable libraries.
pub fn get_missing_libraries(&self) -> BTreeSet<String> {
match self {
Self::Yul(inner) => inner.get_missing_libraries(),
}
}
}
impl From<Yul> for IR {
fn from(inner: Yul) -> Self {
Self::Yul(inner)
}
}