diff --git a/src/lib/js/object.rs b/src/lib/js/object.rs index 0afac09af7f..4228aeb75e8 100644 --- a/src/lib/js/object.rs +++ b/src/lib/js/object.rs @@ -462,7 +462,7 @@ pub fn has_own_prop(this: &Value, args: &[Value], _: &mut Interpreter) -> Result } /// Create a new `Object` object -pub fn _create(global: &Value) -> Value { +pub fn create_constructor(global: &Value) -> Value { let object = to_value(make_object as NativeFunctionData); let prototype = ValueData::new_obj(Some(global)); prototype.set_field_slice( @@ -486,8 +486,3 @@ pub fn _create(global: &Value) -> Value { ); object } - -/// Initialise the `Object` object on the global object -pub fn init(global: &Value) { - global.set_field_slice("Object", _create(global)); -} diff --git a/src/lib/realm.rs b/src/lib/realm.rs index 76eb52eaffc..91a3aa778a5 100644 --- a/src/lib/realm.rs +++ b/src/lib/realm.rs @@ -52,7 +52,6 @@ impl Realm { fn create_instrinsics(&self) { let global = &self.global_obj; // Create intrinsics, add global objects here - object::init(global); function::init(global); global.set_field_slice("String", string::create_constructor(global)); @@ -62,6 +61,7 @@ impl Realm { global.set_field_slice("JSON", json::create_constructor(global)); global.set_field_slice("Math", math::create_constructor(global)); global.set_field_slice("console", console::create_constructor(global)); + global.set_field_slice("Object", object::create_constructor(global)); } }