From 998327aa7efa8fba8986cd1dfa5fb4622e3a691e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=B1=E7=89=B9=E6=AF=8F=E7=BE=8A=E9=98=9F?= Date: Wed, 12 Aug 2026 03:41:22 +0800 Subject: [PATCH] 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. --- crates/oxide_vm/src/bindings/bind_bigint.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/oxide_vm/src/bindings/bind_bigint.rs b/crates/oxide_vm/src/bindings/bind_bigint.rs index f840894..dd9f79e 100644 --- a/crates/oxide_vm/src/bindings/bind_bigint.rs +++ b/crates/oxide_vm/src/bindings/bind_bigint.rs @@ -1,6 +1,6 @@ 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_types::object::{JsObject, PropAttributes}; use oxide_types::value::JsValue; @@ -43,11 +43,20 @@ pub fn bind_bigint(core: &Arc, session: &KernelSession, global: &mut core, &[ ("toString", oxide_builtins::bigint::bigint_to_string:: as *const (), 0), - ("toLocaleString", oxide_builtins::bigint::bigint_to_locale_string:: as *const (), 0), + ( + "toLocaleString", + oxide_builtins::bigint::bigint_to_locale_string:: as *const (), + 0, + ), ("valueOf", oxide_builtins::bigint::bigint_value_of:: 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)); // 全局 BigInt 属性描述符:{ writable: true, enumerable: false, configurable: true }。 let bigint_si = core.perm_interner().intern("BigInt").0;