Skip to content

Commit

Permalink
Fix InstWrite impl for EvmContractSize instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Nak committed Nov 27, 2024
1 parent 36b8403 commit b9d6a93
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions crates/ir/src/inst/evm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use std::io;

use macros::Inst;
pub mod inst_set;

use crate::{inst::impl_inst_write, module::FuncRef, value::ValueId};
use super::{Inst, InstWrite};
use crate::{inst::impl_inst_write, ir_writer::FuncWriteCtx, module::FuncRef, value::ValueId};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Inst)]
pub struct EvmUdiv {
Expand Down Expand Up @@ -570,4 +573,13 @@ impl_inst_write!(EvmMalloc);
pub struct EvmContractSize {
contract: FuncRef,
}
impl_inst_write!(EvmContractSize);
impl InstWrite for EvmContractSize {
fn write(&self, ctx: &FuncWriteCtx, w: &mut dyn io::Write) -> io::Result<()> {
let name = self.as_text();
ctx.func.ctx().func_sig(self.contract, |sig| {
let callee = sig.name();
write!(w, "{name} %{callee}")
})?;
Ok(())
}
}

0 comments on commit b9d6a93

Please sign in to comment.