Skip to content

Commit

Permalink
Merge 5042602 into a357a18
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat authored Apr 17, 2022
2 parents a357a18 + 5042602 commit 54e2798
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions boa_engine/src/context/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{
builtins::{error::r#type::create_throw_type_error, iterable::IteratorPrototypes},
object::{JsObject, ObjectData},
property::PropertyDescriptorBuilder,
Context,
};

Expand Down Expand Up @@ -111,13 +112,16 @@ pub struct StandardConstructors {

impl Default for StandardConstructors {
fn default() -> Self {
Self {
let result = Self {
object: StandardConstructor::default(),
proxy: StandardConstructor::default(),
function: StandardConstructor::default(),
generator: StandardConstructor::default(),
generator_function: StandardConstructor::default(),
array: StandardConstructor::default(),
array: StandardConstructor::with_prototype(JsObject::from_proto_and_data(
None,
ObjectData::array(),
)),
bigint: StandardConstructor::default(),
number: StandardConstructor::with_prototype(JsObject::from_proto_and_data(
None,
Expand Down Expand Up @@ -157,7 +161,20 @@ impl Default for StandardConstructors {
typed_float64_array: StandardConstructor::default(),
array_buffer: StandardConstructor::default(),
data_view: StandardConstructor::default(),
}
};

// The value of `Array.prototype` is the Array prototype object.
result.array.prototype.insert(
"length",
PropertyDescriptorBuilder::new()
.value(0)
.writable(true)
.enumerable(false)
.configurable(false)
.build(),
);

result
}
}

Expand Down

0 comments on commit 54e2798

Please sign in to comment.