interpreter: Instruction fmt

This commit is contained in:
Guillem L. Jara
2026-05-27 08:13:03 +02:00
parent 82b665a2ad
commit 4615b760d3
+16 -2
View File
@@ -148,7 +148,15 @@ impl Display for Instruction {
Self::Jump(label) => {
write!(f, "{op} {label}")
}
_ => todo!(),
Self::Return(src) => {
write!(f, "{op} {src}")
}
Self::IntrinsicCall((dest, code, args)) | Self::IndirectCall((dest, code, args)) => {
write!(f, "{dest} <- {op} {code}, {args}")
}
Self::UserCall((dest, src, args)) => {
write!(f, "{dest} <- {op} {src}, {args}")
}
}
}
}
@@ -207,6 +215,12 @@ impl Display for Reg {
impl Display for NonLocal {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
<_ as Display>::fmt(&self.0, f)
}
}
impl Display for ArgCount {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
<_ as Display>::fmt(&self.0, f)
}
}