feat: BigInt.prototype[Symbol.toStringTag] = "BigInt"
Adds the well-known @@toStringTag data property (writable:false, enumerable:false, configurable:true) so Object.prototype.toString and property descriptors match the spec. Remaining built-ins/BigInt failure (Symbol.toStringTag.js verifyProperty) is blocked on String(Symbol) support in the Symbol track.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::bindings::{apply_binding_table, bind_global_value, configure_native_constructor};
|
use crate::bindings::{apply_binding_table, bind_global_value, bind_well_known_data_property, configure_native_constructor};
|
||||||
use oxide_kernel::kernel::{KernelCore, KernelSession};
|
use oxide_kernel::kernel::{KernelCore, KernelSession};
|
||||||
use oxide_types::object::{JsObject, PropAttributes};
|
use oxide_types::object::{JsObject, PropAttributes};
|
||||||
use oxide_types::value::JsValue;
|
use oxide_types::value::JsValue;
|
||||||
@@ -43,11 +43,20 @@ pub fn bind_bigint(core: &Arc<KernelCore>, session: &KernelSession, global: &mut
|
|||||||
core,
|
core,
|
||||||
&[
|
&[
|
||||||
("toString", oxide_builtins::bigint::bigint_to_string::<crate::vm::Vm> as *const (), 0),
|
("toString", oxide_builtins::bigint::bigint_to_string::<crate::vm::Vm> as *const (), 0),
|
||||||
("toLocaleString", oxide_builtins::bigint::bigint_to_locale_string::<crate::vm::Vm> as *const (), 0),
|
(
|
||||||
|
"toLocaleString",
|
||||||
|
oxide_builtins::bigint::bigint_to_locale_string::<crate::vm::Vm> as *const (),
|
||||||
|
0,
|
||||||
|
),
|
||||||
("valueOf", oxide_builtins::bigint::bigint_value_of::<crate::vm::Vm> as *const (), 0),
|
("valueOf", oxide_builtins::bigint::bigint_value_of::<crate::vm::Vm> as *const (), 0),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// BigInt.prototype[@@toStringTag] = "BigInt",属性 { writable:false, enumerable:false, configurable:true }。
|
||||||
|
let tag_si = core.perm_interner().intern("BigInt").0;
|
||||||
|
let tag_value = JsValue::perm_string(core.perm_interner().string_ptr(tag_si));
|
||||||
|
bind_well_known_data_property(core, proto, 9, tag_value, PropAttributes::new(false, false, true));
|
||||||
|
|
||||||
bind_global_value(core, global, "BigInt", JsValue::from_js_object(ctor_ptr));
|
bind_global_value(core, global, "BigInt", JsValue::from_js_object(ctor_ptr));
|
||||||
// 全局 BigInt 属性描述符:{ writable: true, enumerable: false, configurable: true }。
|
// 全局 BigInt 属性描述符:{ writable: true, enumerable: false, configurable: true }。
|
||||||
let bigint_si = core.perm_interner().intern("BigInt").0;
|
let bigint_si = core.perm_interner().intern("BigInt").0;
|
||||||
|
|||||||
Reference in New Issue
Block a user