refactor(compiler): remove statement jump count helpers

This commit is contained in:
爱特每羊队
2026-08-05 01:17:22 +08:00
parent faa326c039
commit 4a2bf09f78
9 changed files with 28 additions and 175 deletions
@@ -218,6 +218,18 @@ fn compile_switch_break() {
assert!(!module.bytecode.is_empty());
}
#[test]
fn compile_try_finally_resolves_finally_offset() {
let module = compile_source("try { 1; } finally { 2; }");
let try_finally_begin = module
.bytecode
.iter()
.copied()
.find(|&instr| opcode::opcode(instr) == OpCode::TRY_FINALLY_BEGIN)
.expect("try/finally should emit TRY_FINALLY_BEGIN");
assert_ne!(opcode::offset16(try_finally_begin), 0, "finally target offset should be resolved");
}
#[test]
fn compile_continue_in_switch_errors() {
let result = std::panic::catch_unwind(|| {