mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 11:11:11 +08:00
fix: 修复无 else 块时冗余指令跳转问题
This commit is contained in:
@@ -93,9 +93,12 @@ impl Compiler {
|
||||
));
|
||||
}
|
||||
|
||||
let end_pos = ctx.label_map[&end_label];
|
||||
let offset = (end_pos as isize) - (ctx.bytecode.len() as isize);
|
||||
ctx.emit(opcode::encode_jmp(offset as i16));
|
||||
let has_alt = ifs.alternate.is_some();
|
||||
if has_alt {
|
||||
let end_pos = ctx.label_map[&end_label];
|
||||
let offset = (end_pos as isize) - (ctx.bytecode.len() as isize);
|
||||
ctx.emit(opcode::encode_jmp(offset as i16));
|
||||
}
|
||||
|
||||
if let Some(alt) = &ifs.alternate {
|
||||
let alt_reg = self.emit_statement(alt, ctx)?;
|
||||
|
||||
Reference in New Issue
Block a user