fix: 补 Error 族原型与 Math 六函数边及 Symbol 面描述符

This commit is contained in:
2026-09-24 17:33:49 +00:00
parent 44ead358ed
commit 53505dc38c
9 changed files with 334 additions and 53 deletions
+8
View File
@@ -216,6 +216,14 @@ impl BuiltinWorld {
let name_pos = proto.push_prop(name_val);
// 子类型原型上的 name 同 Error.prototype.name:非枚举数据属性。
proto.set_data_meta(name_pos, oxide_types::object::PropAttributes::new(true, false, true));
// 子类型原型上的 message 初始值为空串,描述符同 name。
let si_message = string_forge.intern("message").0;
let empty_si = string_forge.intern("").0;
let empty_val = JsValue::perm_string(string_forge.string_ptr(empty_si));
let msg_shape = shape_forge.make_shape(proto.shape_id(), si_message);
proto.set_shape_id(msg_shape);
let msg_pos = proto.push_prop(empty_val);
proto.set_data_meta(msg_pos, oxide_types::object::PropAttributes::new(true, false, true));
}
/// 把 String 家族方法安装到 String 构造器与原型上。
+7 -2
View File
@@ -7,7 +7,8 @@ use oxide_types::object::JsObject;
use oxide_types::value::JsValue;
use super::construct::{
builtin_labels, make_error_subtypes, make_named_pair, make_typed_array_family, tag_number_proto, tag_string_proto,
builtin_labels, make_error_subtypes, make_named_pair, make_typed_array_family, tag_boolean_proto, tag_number_proto,
tag_string_proto,
wire_builtin_world_links, ErrorSubtypeProtos, TypedArrayFamily,
};
use super::BuiltinWorld;
@@ -196,7 +197,11 @@ impl BuiltinWorld {
(current.number_proto.clone(), current.number_constructor.clone())
};
let (boolean_proto, boolean_constructor) = if dirty.boolean {
make_named_pair(string_forge, shape_forge, labels, "Boolean")
// 脏重建与全量构造同形:原型本体须带 Boolean 对象 tag 与 false 包值,
// 漏此分支 full_reset 后 tag 翻回 "Object"。
let (proto, ctor) = make_named_pair(string_forge, shape_forge, labels, "Boolean");
tag_boolean_proto(&proto);
(proto, ctor)
} else {
(current.boolean_proto.clone(), current.boolean_constructor.clone())
};