mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 03:01:12 +08:00
feat: 七构造器绑定 Symbol.species 静态访问器
This commit is contained in:
@@ -2,8 +2,8 @@ use std::sync::Arc;
|
||||
|
||||
use crate::bind_constructor;
|
||||
use crate::bindings::{
|
||||
apply_binding_table, bind_accessor_getter, bind_method_alias, bind_well_known_method_alias,
|
||||
configure_native_constructor,
|
||||
apply_binding_table, bind_accessor_getter, bind_accessor_getter_key, bind_method_alias,
|
||||
bind_well_known_method_alias, configure_native_constructor,
|
||||
};
|
||||
use oxide_kernel::kernel::{KernelCore, KernelSession};
|
||||
use oxide_types::object::JsObject;
|
||||
@@ -53,5 +53,16 @@ pub fn bind_set(core: &Arc<KernelCore>, session: &KernelSession, global: &mut Js
|
||||
bind_well_known_method_alias(core, proto, "values", 0);
|
||||
bind_accessor_getter(core, session, proto, "size", oxide_builtins::set::set_size::<crate::vm::Vm> as *const ());
|
||||
|
||||
// Set[Symbol.species] 访问器:getter 返回 receiver,派生类沿静态原型链解析
|
||||
// @@species 得自身构造器(规范不给 class 默认 static @@species,类上无 own)。
|
||||
bind_accessor_getter_key(
|
||||
core,
|
||||
session,
|
||||
ctor,
|
||||
oxide_types::private_key::make_well_known_symbol_key(oxide_types::private_key::WELL_KNOWN_SYMBOL_SPECIES),
|
||||
"get [Symbol.species]",
|
||||
oxide_builtins::array::array_species_get::<crate::vm::Vm> as *const (),
|
||||
);
|
||||
|
||||
bind_constructor!(core, global, "Set", ctor_ptr, oxide_builtins::set::set_constructor::<crate::vm::Vm>, 1, hash: true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user