mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
test: 移除 var 与 let 寄存器数相等的过时断言
This commit is contained in:
@@ -9,11 +9,13 @@ fn hash_var_let_const_differ() {
|
||||
let let_ast = oxide_parser::parse(&allocator, "let x = 1").unwrap();
|
||||
let const_ast = oxide_parser::parse(&allocator, "const x = 1").unwrap();
|
||||
|
||||
// 不同的 AST 结构应产出不同的字节码。
|
||||
let var_module = compiler.compile(&var_ast).unwrap();
|
||||
let let_module = compiler.compile(&let_ast).unwrap();
|
||||
let const_module = compiler.compile(&const_ast).unwrap();
|
||||
|
||||
assert_eq!(var_module.n_registers, let_module.n_registers);
|
||||
// let 与 const 词法对称,寄存器数一致。
|
||||
assert_eq!(let_module.n_registers, const_module.n_registers);
|
||||
|
||||
// 顶层 var 因提升预声明与全局属性同步序言,编译产物与 let 不同。
|
||||
assert_ne!(var_module.bytecode, let_module.bytecode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user