mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 11:11:11 +08:00
fix: 全局 var 绑定 0x6F 按 CreateGlobalVarBinding 不更新既有不可写数据描述符,for-in 枚举断言修运算符优先级括号化
This commit is contained in:
@@ -1629,8 +1629,9 @@ impl Emitter {
|
||||
// 函数声明的属性由首个 sub-pass 以函数值覆盖,声明语句保持值更新语义。
|
||||
// builtin 名的全局属性运行期预存(session 绑定):序言值写是单 opcode 值
|
||||
// 混叠,直接写 undefined 会把现存值(NaN 等)抹掉,故以 builtin 镜像槽
|
||||
// (run 起点预载全局属性值)作为写入值——描述符按 CreateGlobalVarBinding
|
||||
// 翻 writable,值幂等保留;裸读走镜像、反射见预存属性。
|
||||
// (run 起点预载全局属性值)作为写入值——CreateGlobalVarBinding 不更新
|
||||
// 既有数据描述符(0x6F 不可写分支 no-op),值幂等保留;裸读走镜像、
|
||||
// 反射见预存属性。
|
||||
let gdi_var_names = self.collect_var_binding_names(&program.body);
|
||||
if !gdi_var_names.is_empty() {
|
||||
let undef_reg = self.emit_undefined(&mut ctx);
|
||||
|
||||
@@ -84,9 +84,9 @@ impl Emitter {
|
||||
ctx.init_var(bi.name.as_str());
|
||||
// 脚本顶层 var:全局对象属性同步绑定当前值(首次声明即 undefined,
|
||||
// 先前已写入则保留写入值,声明不是覆盖性赋值)。被捕获绑定的值
|
||||
// 存在 cell 而非槽,从 cell 同步。builtin 名不同步:描述符翻
|
||||
// writable 已由 GDI 序言以镜像值完成,未初始化的槽/cell 是
|
||||
// undefined,再同步会把现存值(NaN 等)抹掉。
|
||||
// 存在 cell 而非槽,从 cell 同步。builtin 名不同步:CreateGlobalVarBinding
|
||||
// 不更新既有数据描述符,GDI 序言已以镜像值同步(幂等),未初始化
|
||||
// 的槽/cell 是 undefined,再同步会把现存值(NaN 等)抹掉。
|
||||
if ctx.is_global_scope
|
||||
&& matches!(decl.kind, VariableDeclarationKind::Var)
|
||||
&& !CompileCtx::is_known_builtin(bi.name.as_str())
|
||||
|
||||
Reference in New Issue
Block a user