mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 18:51:13 +08:00
fix: 顶层 var 声明带初始化撞不可写全局用户属性 strict 抛 TypeError——用户名声明处写点改 session 解析 PutValue 语义,builtin 名保 GDI 写点;序言缺失分支全局不可扩展两模式对齐抛 TypeError
This commit is contained in:
@@ -108,7 +108,13 @@ impl Emitter {
|
||||
ctx.init_var(name);
|
||||
// 脚本顶层 var:同步写全局对象,使 globalThis.x 反射声明值。
|
||||
if ctx.is_global_scope && matches!(kind, VariableDeclarationKind::Var) {
|
||||
self.emit_global_prop_write(name, src_reg, ctx);
|
||||
if CompileCtx::is_known_builtin(name) {
|
||||
// builtin 名保持 GDI 零动作写点(序言镜像值语义),不扩 strict 面。
|
||||
self.emit_global_prop_write(name, src_reg, ctx);
|
||||
} else {
|
||||
// 用户名既有属性面:声明带初始化是 PutValue,0x98 带 strict 分派。
|
||||
self.emit_global_put_write(name, src_reg, ctx);
|
||||
}
|
||||
}
|
||||
// REPL 持久模式:let/const 也写全局对象属性,使跨轮次读取可见。
|
||||
if ctx.repl_persist && ctx.is_global_scope && !matches!(kind, VariableDeclarationKind::Var) {
|
||||
|
||||
Reference in New Issue
Block a user