feat: with 回退未声明名写落隐式全局

This commit is contained in:
2026-10-09 17:17:49 +00:00
parent 0cbe4dc609
commit 4030cb4224
5 changed files with 97 additions and 27 deletions
+2 -2
View File
@@ -115,8 +115,8 @@ impl Emitter {
));
}
} else if !ctx.with_stack.is_empty() && !ctx.is_with_internal_binding(name) {
// with 内 var 初始化:对象有该属性则写对象,否则写提升槽(动态解析)。
// ponytail: with 内顶层 var 不写全局对象属性,with 语句本身已是稀见用例。
// with 内 var 初始化:对象有该属性则写对象,否则写提升槽(动态解析);
// 未声明名经回退臂落隐式全局,与静态写路径同形。
self.emit_with_dynamic_write(name, src_reg, 0, ctx)?;
} else {
// const 声明路径 STORE_VAR 恒 b=0,不查运行时 guard。