test: 类编译断言更新为新属性描述符字节码布局

This commit is contained in:
2026-08-14 05:45:46 +08:00
parent afe88497f8
commit cc835f5304
2 changed files with 15 additions and 7 deletions
@@ -565,7 +565,7 @@ fn compile_class_expression_emits_constructor_value() {
module
.bytecode
.iter()
.filter(|&&i| opcode::opcode(i) == OpCode::SET_PROP)
.filter(|&&i| opcode::opcode(i) == OpCode::DEFINE_PROP_ATTRS)
.count()
>= 3,
"class expression should wire method/constructor/prototype properties"
@@ -594,7 +594,9 @@ fn compile_large_pure_expression_reuses_temp_registers() {
#[test]
fn compile_builtin_globals_are_registered_lazily() {
let module = compile_source("Object; Array; Math; JSON");
// 数组字面量内全部 4 个引用均为活代码(结果即脚本值),DCE 不可删;
// 未被引用的其它内置全局不得占用槽位。
let module = compile_source("[Object, Array, Math, JSON]");
assert_eq!(module.builtin_reg_map.len(), 4, "only referenced builtins should allocate registers");
}