mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
fix: 可抛算术比较位 opcode 纯标翻转,DCE 不再删副作用指令
This commit is contained in:
@@ -792,3 +792,12 @@ fn compile_delete_new_instanceof_in() {
|
||||
);
|
||||
assert!(module.bytecode.iter().any(|&i| opcode::opcode(i) == OpCode::IN), "in should emit IN");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compile_nonfinal_relational_comparison_kept() {
|
||||
let module = compile_source("let s = 1; s <= 1; s + 1;");
|
||||
assert!(
|
||||
module.bytecode.iter().any(|&i| opcode::opcode(i) == OpCode::LTE),
|
||||
"非末语句形 s <= 1 应保留 LTE 指令(结果虽未用,ToPrimitive 副作用不可删)"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user