Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/compiler-core/src/bytecode/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,10 @@ impl InstructionMetadata for Instruction {
}
}
Self::ContainsOp { invert } => w!(CONTAINS_OP, ?invert),
Self::ConvertValue { oparg } => write!(f, "{:pad$}{}", "CONVERT_VALUE", oparg.get(arg)),
Self::ConvertValue { oparg } => {
let oparg = oparg.get(arg);
write!(f, "{:pad$} {} ({})", "CONVERT_VALUE", oparg.as_u8(), oparg)
}
Comment on lines +1106 to +1109
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix the malformed CONVERT_VALUE disassembly output.

Line 1108 currently concatenates the opcode and numeric operand, producing output like CONVERT_VALUE1 (str). Keep the operands inside the usual parenthesized format.

🐛 Proposed fix
             Self::ConvertValue { oparg } => {
                 let oparg = oparg.get(arg);
-                write!(f, "{:pad$}{} ({})", "CONVERT_VALUE", oparg.as_u8(), oparg)
+                write!(f, "{:pad$}({}, {})", "CONVERT_VALUE", oparg.as_u8(), oparg)
             }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Self::ConvertValue { oparg } => {
let oparg = oparg.get(arg);
write!(f, "{:pad$}{} ({})", "CONVERT_VALUE", oparg.as_u8(), oparg)
}
Self::ConvertValue { oparg } => {
let oparg = oparg.get(arg);
write!(f, "{:pad$}({}, {})", "CONVERT_VALUE", oparg.as_u8(), oparg)
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/compiler-core/src/bytecode/instruction.rs` around lines 1106 - 1109,
The disassembly line for Self::ConvertValue { oparg } is malformed because the
format string writes the numeric operand immediately after the opcode (producing
"CONVERT_VALUE1 (str)"); update the write! call in the Self::ConvertValue match
arm (the write!(f, "...") inside that branch) to put operands into the normal
parenthesized form, e.g. change the format to include a space and wrap the
numeric operand in parentheses (use something like "{:pad$} ({}) ({})" so the
output becomes "CONVERT_VALUE (1) (str)").

Self::Copy { i } => w!(COPY, i),
Self::CopyFreeVars { n } => w!(COPY_FREE_VARS, n),
Self::DeleteAttr { namei } => w!(DELETE_ATTR, name = namei),
Expand Down
Loading
Loading