feat: 添加 DataView 全局构造器
This commit is contained in:
@@ -197,6 +197,8 @@ pub struct BuiltinWorld {
|
||||
pub regexp_proto: P<JsObject>,
|
||||
pub array_buffer_constructor: P<JsObject>,
|
||||
pub array_buffer_proto: P<JsObject>,
|
||||
pub data_view_constructor: P<JsObject>,
|
||||
pub data_view_proto: P<JsObject>,
|
||||
pub sym_match: P<JsObject>,
|
||||
pub sym_replace: P<JsObject>,
|
||||
pub sym_search: P<JsObject>,
|
||||
@@ -289,6 +291,8 @@ impl BuiltinWorld {
|
||||
make_pair(string_forge, shape_forge, "RegExp", si_prototype, si_constructor, si_name);
|
||||
let (array_buffer_proto, array_buffer_constructor) =
|
||||
make_pair(string_forge, shape_forge, "ArrayBuffer", si_prototype, si_constructor, si_name);
|
||||
let (data_view_proto, data_view_constructor) =
|
||||
make_pair(string_forge, shape_forge, "DataView", si_prototype, si_constructor, si_name);
|
||||
|
||||
let sym_match = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
let sym_replace = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
@@ -327,10 +331,11 @@ impl BuiltinWorld {
|
||||
wire_ctor_proto(&set_constructor, &set_proto);
|
||||
wire_ctor_proto(&map_constructor, &map_proto);
|
||||
wire_ctor_proto(&array_buffer_constructor, &array_buffer_proto);
|
||||
wire_ctor_proto(&data_view_constructor, &data_view_proto);
|
||||
|
||||
// Wire prototype chains: all constructor prototypes inherit from Object.prototype.
|
||||
let obj_proto_val = JsValue::from_js_object(object_proto.as_ptr() as *mut JsObject);
|
||||
let non_object_protos: [&P<JsObject>; 12] = [
|
||||
let non_object_protos: [&P<JsObject>; 13] = [
|
||||
&array_proto,
|
||||
&function_proto,
|
||||
&string_proto,
|
||||
@@ -343,6 +348,7 @@ impl BuiltinWorld {
|
||||
&map_proto,
|
||||
®exp_proto,
|
||||
&array_buffer_proto,
|
||||
&data_view_proto,
|
||||
];
|
||||
for proto in &non_object_protos {
|
||||
let p = proto.as_ptr() as *mut JsObject;
|
||||
@@ -385,6 +391,8 @@ impl BuiltinWorld {
|
||||
regexp_proto,
|
||||
array_buffer_constructor,
|
||||
array_buffer_proto,
|
||||
data_view_constructor,
|
||||
data_view_proto,
|
||||
sym_match,
|
||||
sym_replace,
|
||||
sym_search,
|
||||
|
||||
Reference in New Issue
Block a user