Skip to content

Commit

Permalink
Updated object global (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
DomParfitt authored and jasonwilliams committed Oct 17, 2019
1 parent fc8fb01 commit 9246952
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/lib/js/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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));
}
2 changes: 1 addition & 1 deletion src/lib/realm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
}
}

Expand Down

0 comments on commit 9246952

Please sign in to comment.