mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 11:11:11 +08:00
fix: 全局三常量描述符翻可配置,var 重复声明以 builtin 镜像值保留现存值
This commit is contained in:
@@ -84,8 +84,13 @@ impl Emitter {
|
||||
ctx.init_var(bi.name.as_str());
|
||||
// 脚本顶层 var:全局对象属性同步绑定当前值(首次声明即 undefined,
|
||||
// 先前已写入则保留写入值,声明不是覆盖性赋值)。被捕获绑定的值
|
||||
// 存在 cell 而非槽,从 cell 同步。
|
||||
if ctx.is_global_scope && matches!(decl.kind, VariableDeclarationKind::Var) {
|
||||
// 存在 cell 而非槽,从 cell 同步。builtin 名不同步:描述符翻
|
||||
// writable 已由 GDI 序言以镜像值完成,未初始化的槽/cell 是
|
||||
// undefined,再同步会把现存值(NaN 等)抹掉。
|
||||
if ctx.is_global_scope
|
||||
&& matches!(decl.kind, VariableDeclarationKind::Var)
|
||||
&& !CompileCtx::is_known_builtin(bi.name.as_str())
|
||||
{
|
||||
let src = if let Some(&cell_idx) = ctx.captured_bindings.get(bi.name.as_str()) {
|
||||
let r = ctx.alloc_reg();
|
||||
if let Some((binding, _)) = ctx.scopes.symbols.lookup_any_binding(bi.name.as_str()) {
|
||||
|
||||
Reference in New Issue
Block a user