feat: 添加 do while 与 for-in 语法枚举指令支持

This commit is contained in:
爱特每羊队
2026-06-06 18:18:31 +08:00
parent 04f465d0de
commit 01cd250eda
7 changed files with 70 additions and 1 deletions
+4
View File
@@ -39,6 +39,10 @@ impl fmt::Display for CompiledModule {
OpCode::JMP | OpCode::JMP_IF_FALSE | OpCode::JMP_IF_TRUE => {
write!(f, " r{rd}, {offset:+}", offset = opcode::offset16(instr))?;
}
OpCode::SWITCH_TABLE => {
let n_cases = rd as u16 | ((b as u16) << 8);
write!(f, " r{disc_reg}={a}, {n_cases} cases", disc_reg = a)?;
}
OpCode::RETURN | OpCode::HALT | OpCode::NOP => {
write!(f, " r{rd}")?;
}