mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
feat: 新增 Symbol.species well-known symbol 绑定(Symbol.species 解析/键槽/内建对象)
This commit is contained in:
@@ -251,6 +251,7 @@ pub struct BuiltinWorld {
|
||||
pub sym_match_all: P<JsObject>,
|
||||
pub sym_async_iterator: P<JsObject>,
|
||||
pub sym_to_string_tag: P<JsObject>,
|
||||
pub sym_species: P<JsObject>,
|
||||
pub temporal_object: P<JsObject>,
|
||||
pub temporal_now_object: P<JsObject>,
|
||||
pub instant_constructor: P<JsObject>,
|
||||
@@ -702,6 +703,7 @@ impl BuiltinWorld {
|
||||
BuiltinId::SymMatchAll => &self.sym_match_all,
|
||||
BuiltinId::SymAsyncIterator => &self.sym_async_iterator,
|
||||
BuiltinId::SymToStringTag => &self.sym_to_string_tag,
|
||||
BuiltinId::SymSpecies => &self.sym_species,
|
||||
BuiltinId::TemporalObject => &self.temporal_object,
|
||||
BuiltinId::TemporalNowObject => &self.temporal_now_object,
|
||||
BuiltinId::InstantConstructor => &self.instant_constructor,
|
||||
@@ -760,6 +762,7 @@ impl BuiltinWorld {
|
||||
let sym_match_all = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
let sym_async_iterator = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
let sym_to_string_tag = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
let sym_species = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
let temporal_object = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
let temporal_now_object = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
let (instant_proto, instant_constructor) = make_named_pair(string_forge, shape_forge, labels, "Instant");
|
||||
@@ -846,6 +849,7 @@ impl BuiltinWorld {
|
||||
sym_match_all,
|
||||
sym_async_iterator,
|
||||
sym_to_string_tag,
|
||||
sym_species,
|
||||
temporal_object,
|
||||
temporal_now_object,
|
||||
instant_constructor,
|
||||
@@ -936,6 +940,7 @@ impl BuiltinWorld {
|
||||
sym_match_all,
|
||||
sym_async_iterator,
|
||||
sym_to_string_tag,
|
||||
sym_species,
|
||||
) = if dirty.symbol_family {
|
||||
let (symbol_proto, symbol_constructor) = make_named_pair(string_forge, shape_forge, labels, "Symbol");
|
||||
(
|
||||
@@ -951,6 +956,7 @@ impl BuiltinWorld {
|
||||
P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
|
||||
P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
|
||||
P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
|
||||
P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
@@ -966,6 +972,7 @@ impl BuiltinWorld {
|
||||
current.sym_match_all.clone(),
|
||||
current.sym_async_iterator.clone(),
|
||||
current.sym_to_string_tag.clone(),
|
||||
current.sym_species.clone(),
|
||||
)
|
||||
};
|
||||
|
||||
@@ -1177,6 +1184,7 @@ impl BuiltinWorld {
|
||||
sym_match_all,
|
||||
sym_async_iterator,
|
||||
sym_to_string_tag,
|
||||
sym_species,
|
||||
temporal_object,
|
||||
temporal_now_object,
|
||||
instant_constructor,
|
||||
|
||||
@@ -225,7 +225,7 @@ pub struct KernelSession {
|
||||
/// 维护注意:每个新增的 `BuiltinWorld` 对象字段都必须加到这里以及
|
||||
/// `KernelSession::dirty_since_snapshot()`,以便选择性重置重建正确的
|
||||
/// builtin 家族。
|
||||
pub const NUM_BUILTINS: usize = 85;
|
||||
pub const NUM_BUILTINS: usize = 86;
|
||||
|
||||
/// 内置对象枚举 id,与 `BuiltinWorld` 中的存储槽一一对应。
|
||||
///
|
||||
@@ -315,6 +315,7 @@ pub enum BuiltinId {
|
||||
DurationConstructor = 78,
|
||||
DurationProto = 79,
|
||||
SymToStringTag = 80,
|
||||
SymSpecies = 85,
|
||||
ZonedDateTimeConstructor = 81,
|
||||
ZonedDateTimeProto = 82,
|
||||
PlainDateTimeConstructor = 83,
|
||||
@@ -405,6 +406,7 @@ impl BuiltinId {
|
||||
BuiltinId::DurationConstructor,
|
||||
BuiltinId::DurationProto,
|
||||
BuiltinId::SymToStringTag,
|
||||
BuiltinId::SymSpecies,
|
||||
BuiltinId::ZonedDateTimeConstructor,
|
||||
BuiltinId::ZonedDateTimeProto,
|
||||
BuiltinId::PlainDateTimeConstructor,
|
||||
@@ -597,7 +599,8 @@ impl KernelSession {
|
||||
|| gen(BuiltinId::SymHasInstance) != snap(BuiltinId::SymHasInstance)
|
||||
|| gen(BuiltinId::SymMatchAll) != snap(BuiltinId::SymMatchAll)
|
||||
|| gen(BuiltinId::SymAsyncIterator) != snap(BuiltinId::SymAsyncIterator)
|
||||
|| gen(BuiltinId::SymToStringTag) != snap(BuiltinId::SymToStringTag),
|
||||
|| gen(BuiltinId::SymToStringTag) != snap(BuiltinId::SymToStringTag)
|
||||
|| gen(BuiltinId::SymSpecies) != snap(BuiltinId::SymSpecies),
|
||||
math: gen(BuiltinId::MathObject) != snap(BuiltinId::MathObject),
|
||||
json: gen(BuiltinId::JsonObject) != snap(BuiltinId::JsonObject),
|
||||
date: gen(BuiltinId::DateConstructor) != snap(BuiltinId::DateConstructor)
|
||||
|
||||
Reference in New Issue
Block a user