mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
feat: with 语句、成员位/移位复合赋值、CALL_NATIVE 无目标修复
with 语句:新增 emit 支持,with 体内自由标识符动态解析(对象属性优先, 回退外层),支持读/写/复合赋值/自增自减/delete/var 初始化动态化, TO_OBJECT opcode 处理原始值对象,顶层 this 绑定全局对象。 复合赋值:新增 6 个 COMPOUND_MEMBER_BIT_* opcode 支持成员位/移位复合赋值, 修复 computed member 复合赋值覆盖 bug,with 内标识符复合赋值动态化。 CALL_NATIVE:实现全局 isNaN/isFinite 并绑定,用户覆盖 builtin 名时 回退通用调用路径而非报错,局部遮蔽 builtin 名走普通 CALL。 test262: with 34 pass(基线 0),compound-assignment 320 pass(基线 223)
This commit is contained in:
@@ -77,6 +77,12 @@ impl Vm {
|
||||
return self.raise_type_error("CALL_NATIVE target is null");
|
||||
}
|
||||
let obj = unsafe { &*obj_ptr };
|
||||
// 目标为普通 JS 函数(如用户覆盖了 builtin 名):回退到通用调用路径,
|
||||
// 复用 dispatch_call 的 JS 函数调用逻辑而非强制走 native。
|
||||
// pc 此刻指向 ext 字(与 CALL 指令一致),dispatch_call 直接读取。
|
||||
if obj.is_function() && obj.native_fn().is_none() {
|
||||
return self.dispatch_call(rd, a, b).map(|_| ());
|
||||
}
|
||||
if !obj.is_function() || obj.native_fn().is_none() {
|
||||
return self.raise_type_error("CALL_NATIVE target is not a native function");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user