mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 10:41:11 +08:00
perf: indexOf/includes/lastIndexOf 支持 ArrayLike,补 .name/.length 属性
- Array indexOf/includes/lastIndexOf:ArrayLike 接收者 + fromIndex + SameValueZero - Function.prototype 方法补 .length 属性,经 bind_method_static 绑定 - Error 对象补 .name 属性,经 create_kind_error 生成 - 构造器函数补 .name 与 .length,经 make_pair / bind_constructor! 绑定
This commit is contained in:
@@ -49,6 +49,11 @@ macro_rules! bind_constructor {
|
||||
let ptr: *const () = ($ctor_fn as fn(&mut $crate::vm::Vm, &[u8]) -> oxide_runtime_api::NativeResult) as *const ();
|
||||
ctor.set_native_fn(Some(unsafe { oxide_types::object::NativeFnPtr::from_raw(ptr) }));
|
||||
ctor.set_native_arg_count($nargs);
|
||||
// 设置 constructor.length (Function.length = formal parameter count)
|
||||
let length_si = $core.perm_interner().intern("length").0;
|
||||
let length_shape = $core.shape_forge().make_shape(ctor.shape_id(), length_si);
|
||||
ctor.set_shape_id(length_shape);
|
||||
ctor.ensure_hash_props().push($crate::JsValue::int($nargs as i32));
|
||||
}};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user