Skip to content

Commit f2f2017

Browse files
authored
oparg_enum! to support custom display value (#7654)
1 parent a693a0c commit f2f2017

2 files changed

Lines changed: 110 additions & 141 deletions

File tree

crates/compiler-core/src/bytecode/instruction.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,10 @@ impl InstructionMetadata for Instruction {
11031103
}
11041104
}
11051105
Self::ContainsOp { invert } => w!(CONTAINS_OP, ?invert),
1106-
Self::ConvertValue { oparg } => write!(f, "{:pad$}{}", "CONVERT_VALUE", oparg.get(arg)),
1106+
Self::ConvertValue { oparg } => {
1107+
let oparg = oparg.get(arg);
1108+
write!(f, "{:pad$} {} ({})", "CONVERT_VALUE", oparg.as_u8(), oparg)
1109+
}
11071110
Self::Copy { i } => w!(COPY, i),
11081111
Self::CopyFreeVars { n } => w!(COPY_FREE_VARS, n),
11091112
Self::DeleteAttr { namei } => w!(DELETE_ATTR, name = namei),

0 commit comments

Comments
 (0)