mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 11:41:13 +08:00
fix: 顶层 var 全局属性求值前创建(声明定时语义)+ 无初始化 var 声明不再抹槽值
This commit is contained in:
@@ -14,7 +14,8 @@ fn compile_source(source: &str) -> CompiledModule {
|
||||
fn compile_var_declaration() {
|
||||
let module = compile_source("var x = 42;");
|
||||
assert!(!module.bytecode.is_empty());
|
||||
assert_eq!(module.constants[0], Constant::Int(42));
|
||||
// 常量池下标不固定(声明实例化序言可能先入池 Undefined),只断言成员存在。
|
||||
assert!(module.constants.contains(&Constant::Int(42)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -14,7 +14,8 @@ fn compile_source(source: &str) -> CompiledModule {
|
||||
fn symbol_table_declare_and_lookup() {
|
||||
let module = compile_source("var x = 42;");
|
||||
assert!(!module.bytecode.is_empty());
|
||||
assert_eq!(module.constants[0], Constant::Int(42));
|
||||
// 常量池下标不固定(声明实例化序言可能先入池 Undefined),只断言成员存在。
|
||||
assert!(module.constants.contains(&Constant::Int(42)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user