diff --git a/boa/src/builtins/array/array_iterator.rs b/boa/src/builtins/array/array_iterator.rs index 191553d48ed..6583a2c84f1 100644 --- a/boa/src/builtins/array/array_iterator.rs +++ b/boa/src/builtins/array/array_iterator.rs @@ -47,7 +47,7 @@ impl ArrayIterator { context: &Context, ) -> JsValue { let array_iterator = JsObject::from_proto_and_data( - Some(context.iterator_prototypes().array_iterator()), + context.iterator_prototypes().array_iterator(), ObjectData::array_iterator(Self::new(array, kind)), ); array_iterator.into() @@ -129,7 +129,7 @@ impl ArrayIterator { // Create prototype let array_iterator = - JsObject::from_proto_and_data(Some(iterator_prototype), ObjectData::ordinary()); + JsObject::from_proto_and_data(iterator_prototype, ObjectData::ordinary()); make_builtin_fn(Self::next, "next", &array_iterator, 0, context); let to_string_tag = WellKnownSymbols::to_string_tag(); diff --git a/boa/src/builtins/array/mod.rs b/boa/src/builtins/array/mod.rs index 64ab7418f7c..6b67f6addd6 100644 --- a/boa/src/builtins/array/mod.rs +++ b/boa/src/builtins/array/mod.rs @@ -223,7 +223,7 @@ impl Array { Some(prototype) => prototype, None => context.standard_objects().array_object().prototype(), }; - let array = JsObject::from_proto_and_data(Some(prototype), ObjectData::array()); + let array = JsObject::from_proto_and_data(prototype, ObjectData::array()); // 6. Perform ! OrdinaryDefineOwnProperty(A, "length", PropertyDescriptor { [[Value]]: 𝔽(length), [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false }). crate::object::internal_methods::ordinary_define_own_property( diff --git a/boa/src/builtins/boolean/mod.rs b/boa/src/builtins/boolean/mod.rs index 279439f61f8..02c31e2db8a 100644 --- a/boa/src/builtins/boolean/mod.rs +++ b/boa/src/builtins/boolean/mod.rs @@ -71,7 +71,7 @@ impl Boolean { } let prototype = get_prototype_from_constructor(new_target, StandardObjects::boolean_object, context)?; - let boolean = JsObject::from_proto_and_data(Some(prototype), ObjectData::boolean(data)); + let boolean = JsObject::from_proto_and_data(prototype, ObjectData::boolean(data)); Ok(boolean.into()) } diff --git a/boa/src/builtins/date/mod.rs b/boa/src/builtins/date/mod.rs index 88a571c7cc0..a2757019eab 100644 --- a/boa/src/builtins/date/mod.rs +++ b/boa/src/builtins/date/mod.rs @@ -384,7 +384,7 @@ impl Date { /// [spec]: https://tc39.es/ecma262/#sec-date-constructor /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date pub(crate) fn make_date_now(prototype: JsObject) -> JsObject { - JsObject::from_proto_and_data(Some(prototype), ObjectData::date(Date::default())) + JsObject::from_proto_and_data(prototype, ObjectData::date(Date::default())) } /// `Date(value)` @@ -425,7 +425,7 @@ impl Date { let tv = tv.filter(|time| Self::time_clip(time.timestamp_millis() as f64).is_some()); Ok(JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::date(Date(tv)), )) } @@ -466,7 +466,7 @@ impl Date { // If any of the args are infinity or NaN, return an invalid date. if !check_normal_opt!(year, month, day, hour, min, sec, milli) { return Ok(JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::date(Date(None)), )); } @@ -494,7 +494,7 @@ impl Date { ); Ok(JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::date(date), )) } diff --git a/boa/src/builtins/error/eval.rs b/boa/src/builtins/error/eval.rs index 9b76ea0d9a0..bd941a0c043 100644 --- a/boa/src/builtins/error/eval.rs +++ b/boa/src/builtins/error/eval.rs @@ -67,7 +67,7 @@ impl EvalError { ) -> JsResult { let prototype = get_prototype_from_constructor(new_target, StandardObjects::error_object, context)?; - let obj = JsObject::from_proto_and_data(Some(prototype), ObjectData::error()); + let obj = JsObject::from_proto_and_data(prototype, ObjectData::error()); if let Some(message) = args.get(0) { if !message.is_undefined() { obj.set("message", message.to_string(context)?, false, context)?; diff --git a/boa/src/builtins/error/mod.rs b/boa/src/builtins/error/mod.rs index 7899b9d27e5..2dd5c036673 100644 --- a/boa/src/builtins/error/mod.rs +++ b/boa/src/builtins/error/mod.rs @@ -83,7 +83,7 @@ impl Error { ) -> JsResult { let prototype = get_prototype_from_constructor(new_target, StandardObjects::error_object, context)?; - let obj = JsObject::from_proto_and_data(Some(prototype), ObjectData::error()); + let obj = JsObject::from_proto_and_data(prototype, ObjectData::error()); if let Some(message) = args.get(0) { if !message.is_undefined() { obj.set("message", message.to_string(context)?, false, context)?; diff --git a/boa/src/builtins/error/range.rs b/boa/src/builtins/error/range.rs index 88b97a8a051..1b62980b24b 100644 --- a/boa/src/builtins/error/range.rs +++ b/boa/src/builtins/error/range.rs @@ -64,7 +64,7 @@ impl RangeError { ) -> JsResult { let prototype = get_prototype_from_constructor(new_target, StandardObjects::error_object, context)?; - let obj = JsObject::from_proto_and_data(Some(prototype), ObjectData::error()); + let obj = JsObject::from_proto_and_data(prototype, ObjectData::error()); if let Some(message) = args.get(0) { if !message.is_undefined() { obj.set("message", message.to_string(context)?, false, context)?; diff --git a/boa/src/builtins/error/reference.rs b/boa/src/builtins/error/reference.rs index ea1a236b91e..663fee744ce 100644 --- a/boa/src/builtins/error/reference.rs +++ b/boa/src/builtins/error/reference.rs @@ -63,7 +63,7 @@ impl ReferenceError { ) -> JsResult { let prototype = get_prototype_from_constructor(new_target, StandardObjects::error_object, context)?; - let obj = JsObject::from_proto_and_data(Some(prototype), ObjectData::error()); + let obj = JsObject::from_proto_and_data(prototype, ObjectData::error()); if let Some(message) = args.get(0) { if !message.is_undefined() { obj.set("message", message.to_string(context)?, false, context)?; diff --git a/boa/src/builtins/error/syntax.rs b/boa/src/builtins/error/syntax.rs index 5353313d881..027fd040d05 100644 --- a/boa/src/builtins/error/syntax.rs +++ b/boa/src/builtins/error/syntax.rs @@ -66,7 +66,7 @@ impl SyntaxError { ) -> JsResult { let prototype = get_prototype_from_constructor(new_target, StandardObjects::error_object, context)?; - let obj = JsObject::from_proto_and_data(Some(prototype), ObjectData::error()); + let obj = JsObject::from_proto_and_data(prototype, ObjectData::error()); if let Some(message) = args.get(0) { if !message.is_undefined() { obj.set("message", message.to_string(context)?, false, context)?; diff --git a/boa/src/builtins/error/type.rs b/boa/src/builtins/error/type.rs index 6eec1096ab1..5a42856d9ed 100644 --- a/boa/src/builtins/error/type.rs +++ b/boa/src/builtins/error/type.rs @@ -69,7 +69,7 @@ impl TypeError { ) -> JsResult { let prototype = get_prototype_from_constructor(new_target, StandardObjects::error_object, context)?; - let obj = JsObject::from_proto_and_data(Some(prototype), ObjectData::error()); + let obj = JsObject::from_proto_and_data(prototype, ObjectData::error()); if let Some(message) = args.get(0) { if !message.is_undefined() { obj.set("message", message.to_string(context)?, false, context)?; diff --git a/boa/src/builtins/error/uri.rs b/boa/src/builtins/error/uri.rs index dbdaa6fb38b..b90c8934e95 100644 --- a/boa/src/builtins/error/uri.rs +++ b/boa/src/builtins/error/uri.rs @@ -65,7 +65,7 @@ impl UriError { ) -> JsResult { let prototype = get_prototype_from_constructor(new_target, StandardObjects::error_object, context)?; - let obj = JsObject::from_proto_and_data(Some(prototype), ObjectData::error()); + let obj = JsObject::from_proto_and_data(prototype, ObjectData::error()); if let Some(message) = args.get(0) { if !message.is_undefined() { obj.set("message", message.to_string(context)?, false, context)?; diff --git a/boa/src/builtins/function/mod.rs b/boa/src/builtins/function/mod.rs index 8eb8c42df45..0cc9daf398d 100644 --- a/boa/src/builtins/function/mod.rs +++ b/boa/src/builtins/function/mod.rs @@ -359,7 +359,7 @@ pub(crate) fn make_builtin_fn( let _timer = BoaProfiler::global().start_event(&format!("make_builtin_fn: {}", &name), "init"); let function = JsObject::from_proto_and_data( - Some(interpreter.standard_objects().function_object().prototype()), + interpreter.standard_objects().function_object().prototype(), ObjectData::function(Function::Native { function, constructable: false, @@ -397,7 +397,7 @@ impl BuiltInFunctionObject { get_prototype_from_constructor(new_target, StandardObjects::function_object, context)?; let this = JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::function(Function::Native { function: |_, _, _| Ok(JsValue::undefined()), constructable: true, diff --git a/boa/src/builtins/map/map_iterator.rs b/boa/src/builtins/map/map_iterator.rs index 7664ecf2740..6d72ff17da5 100644 --- a/boa/src/builtins/map/map_iterator.rs +++ b/boa/src/builtins/map/map_iterator.rs @@ -48,7 +48,7 @@ impl MapIterator { lock, }; let map_iterator = JsObject::from_proto_and_data( - Some(context.iterator_prototypes().map_iterator()), + context.iterator_prototypes().map_iterator(), ObjectData::map_iterator(iter), ); return Ok(map_iterator.into()); @@ -129,7 +129,7 @@ impl MapIterator { // Create prototype let map_iterator = - JsObject::from_proto_and_data(Some(iterator_prototype), ObjectData::ordinary()); + JsObject::from_proto_and_data(iterator_prototype, ObjectData::ordinary()); make_builtin_fn(Self::next, "next", &map_iterator, 0, context); let to_string_tag = WellKnownSymbols::to_string_tag(); diff --git a/boa/src/builtins/map/mod.rs b/boa/src/builtins/map/mod.rs index 2958f209872..ac764caae2e 100644 --- a/boa/src/builtins/map/mod.rs +++ b/boa/src/builtins/map/mod.rs @@ -136,8 +136,7 @@ impl Map { // 3. Set map.[[MapData]] to a new empty List. let prototype = get_prototype_from_constructor(new_target, StandardObjects::map_object, context)?; - let map = - JsObject::from_proto_and_data(Some(prototype), ObjectData::map(OrderedMap::new())); + let map = JsObject::from_proto_and_data(prototype, ObjectData::map(OrderedMap::new())); // 4. If iterable is either undefined or null, return map. let iterable = match args.get_or_undefined(0) { diff --git a/boa/src/builtins/number/mod.rs b/boa/src/builtins/number/mod.rs index 49c1f920211..2cf2b5b8f80 100644 --- a/boa/src/builtins/number/mod.rs +++ b/boa/src/builtins/number/mod.rs @@ -170,7 +170,7 @@ impl Number { } let prototype = get_prototype_from_constructor(new_target, StandardObjects::number_object, context)?; - let this = JsObject::from_proto_and_data(Some(prototype), ObjectData::number(data)); + let this = JsObject::from_proto_and_data(prototype, ObjectData::number(data)); Ok(this.into()) } diff --git a/boa/src/builtins/object/for_in_iterator.rs b/boa/src/builtins/object/for_in_iterator.rs index 70ed65607ca..dc85030d6cc 100644 --- a/boa/src/builtins/object/for_in_iterator.rs +++ b/boa/src/builtins/object/for_in_iterator.rs @@ -47,7 +47,7 @@ impl ForInIterator { /// [spec]: https://tc39.es/ecma262/#sec-createforiniterator pub(crate) fn create_for_in_iterator(object: JsValue, context: &Context) -> JsValue { let for_in_iterator = JsObject::from_proto_and_data( - Some(context.iterator_prototypes().for_in_iterator()), + context.iterator_prototypes().for_in_iterator(), ObjectData::for_in_iterator(Self::new(object)), ); for_in_iterator.into() @@ -135,7 +135,7 @@ impl ForInIterator { // Create prototype let for_in_iterator = - JsObject::from_proto_and_data(Some(iterator_prototype), ObjectData::ordinary()); + JsObject::from_proto_and_data(iterator_prototype, ObjectData::ordinary()); make_builtin_fn(Self::next, "next", &for_in_iterator, 0, context); let to_string_tag = WellKnownSymbols::to_string_tag(); diff --git a/boa/src/builtins/object/mod.rs b/boa/src/builtins/object/mod.rs index 853e3904b2c..9b516ec8c13 100644 --- a/boa/src/builtins/object/mod.rs +++ b/boa/src/builtins/object/mod.rs @@ -107,7 +107,7 @@ impl Object { StandardObjects::object_object, context, )?; - let object = JsObject::from_proto_and_data(Some(prototype), ObjectData::ordinary()); + let object = JsObject::from_proto_and_data(prototype, ObjectData::ordinary()); return Ok(object.into()); } if let Some(arg) = args.get(0) { diff --git a/boa/src/builtins/regexp/mod.rs b/boa/src/builtins/regexp/mod.rs index 1a4e9c5dfb7..f6386a85128 100644 --- a/boa/src/builtins/regexp/mod.rs +++ b/boa/src/builtins/regexp/mod.rs @@ -263,7 +263,7 @@ impl RegExp { fn alloc(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult { let proto = get_prototype_from_constructor(this, StandardObjects::regexp_object, context)?; - Ok(JsObject::from_proto_and_data(Some(proto), ObjectData::ordinary()).into()) + Ok(JsObject::from_proto_and_data(proto, ObjectData::ordinary()).into()) } /// `22.2.3.2.2 RegExpInitialize ( obj, pattern, flags )` diff --git a/boa/src/builtins/regexp/regexp_string_iterator.rs b/boa/src/builtins/regexp/regexp_string_iterator.rs index 4d96822583d..6754a58f5e3 100644 --- a/boa/src/builtins/regexp/regexp_string_iterator.rs +++ b/boa/src/builtins/regexp/regexp_string_iterator.rs @@ -68,7 +68,7 @@ impl RegExpStringIterator { // 5. Return ! CreateIteratorFromClosure(closure, "%RegExpStringIteratorPrototype%", %RegExpStringIteratorPrototype%). let regexp_string_iterator = JsObject::from_proto_and_data( - Some(context.iterator_prototypes().regexp_string_iterator()), + context.iterator_prototypes().regexp_string_iterator(), ObjectData::reg_exp_string_iterator(Self::new( matcher.clone(), string, @@ -162,8 +162,7 @@ impl RegExpStringIterator { let _timer = BoaProfiler::global().start_event("RegExp String Iterator", "init"); // Create prototype - let result = - JsObject::from_proto_and_data(Some(iterator_prototype), ObjectData::ordinary()); + let result = JsObject::from_proto_and_data(iterator_prototype, ObjectData::ordinary()); make_builtin_fn(Self::next, "next", &result, 0, context); let to_string_tag = WellKnownSymbols::to_string_tag(); diff --git a/boa/src/builtins/set/mod.rs b/boa/src/builtins/set/mod.rs index 9b7cf66970c..1a21f439201 100644 --- a/boa/src/builtins/set/mod.rs +++ b/boa/src/builtins/set/mod.rs @@ -130,8 +130,7 @@ impl Set { let prototype = get_prototype_from_constructor(new_target, StandardObjects::set_object, context)?; - let obj = - JsObject::from_proto_and_data(Some(prototype), ObjectData::set(OrderedSet::default())); + let obj = JsObject::from_proto_and_data(prototype, ObjectData::set(OrderedSet::default())); let iterable = args.get_or_undefined(0); // 4 diff --git a/boa/src/builtins/set/set_iterator.rs b/boa/src/builtins/set/set_iterator.rs index 039d141fd1c..d7a0437e047 100644 --- a/boa/src/builtins/set/set_iterator.rs +++ b/boa/src/builtins/set/set_iterator.rs @@ -48,7 +48,7 @@ impl SetIterator { context: &Context, ) -> JsValue { let set_iterator = JsObject::from_proto_and_data( - Some(context.iterator_prototypes().set_iterator()), + context.iterator_prototypes().set_iterator(), ObjectData::set_iterator(Self::new(set, kind)), ); set_iterator.into() @@ -146,7 +146,7 @@ impl SetIterator { // Create prototype let set_iterator = - JsObject::from_proto_and_data(Some(iterator_prototype), ObjectData::ordinary()); + JsObject::from_proto_and_data(iterator_prototype, ObjectData::ordinary()); make_builtin_fn(Self::next, "next", &set_iterator, 0, context); let to_string_tag = WellKnownSymbols::to_string_tag(); diff --git a/boa/src/builtins/string/mod.rs b/boa/src/builtins/string/mod.rs index fa78eec5808..0ce79e3d6ac 100644 --- a/boa/src/builtins/string/mod.rs +++ b/boa/src/builtins/string/mod.rs @@ -205,7 +205,7 @@ impl String { // 4. Set S.[[GetOwnProperty]] as specified in 10.4.3.1. // 5. Set S.[[DefineOwnProperty]] as specified in 10.4.3.2. // 6. Set S.[[OwnPropertyKeys]] as specified in 10.4.3.3. - let s = JsObject::from_proto_and_data(Some(prototype), ObjectData::string(value)); + let s = JsObject::from_proto_and_data(prototype, ObjectData::string(value)); // 8. Perform ! DefinePropertyOrThrow(S, "length", PropertyDescriptor { [[Value]]: 𝔽(length), // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }). diff --git a/boa/src/builtins/string/string_iterator.rs b/boa/src/builtins/string/string_iterator.rs index 3ced382c9bd..2adf8e80694 100644 --- a/boa/src/builtins/string/string_iterator.rs +++ b/boa/src/builtins/string/string_iterator.rs @@ -25,7 +25,7 @@ impl StringIterator { pub fn create_string_iterator(string: JsValue, context: &mut Context) -> JsResult { let string_iterator = JsObject::from_proto_and_data( - Some(context.iterator_prototypes().string_iterator()), + context.iterator_prototypes().string_iterator(), ObjectData::string_iterator(Self::new(string)), ); Ok(string_iterator.into()) @@ -84,7 +84,7 @@ impl StringIterator { // Create prototype let array_iterator = - JsObject::from_proto_and_data(Some(iterator_prototype), ObjectData::ordinary()); + JsObject::from_proto_and_data(iterator_prototype, ObjectData::ordinary()); make_builtin_fn(Self::next, "next", &array_iterator, 0, context); let to_string_tag = WellKnownSymbols::to_string_tag(); diff --git a/boa/src/class.rs b/boa/src/class.rs index 4eb1551f562..bc7806eca1b 100644 --- a/boa/src/class.rs +++ b/boa/src/class.rs @@ -141,7 +141,7 @@ impl ClassConstructor for T { let native_instance = Self::constructor(this, args, context)?; let object_instance = JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::native_object(Box::new(native_instance)), ); Ok(object_instance.into()) diff --git a/boa/src/context.rs b/boa/src/context.rs index ffde9b71a11..25114da567c 100644 --- a/boa/src/context.rs +++ b/boa/src/context.rs @@ -496,8 +496,10 @@ impl Context { /// Constructs an object with the `%Object.prototype%` prototype. #[inline] pub fn construct_object(&self) -> JsObject { - let object_prototype = self.standard_objects().object_object().prototype(); - JsObject::from_proto_and_data(Some(object_prototype), ObjectData::ordinary()) + JsObject::from_proto_and_data( + self.standard_objects().object_object().prototype(), + ObjectData::ordinary(), + ) } /// @@ -715,7 +717,7 @@ impl Context { }; let function = - JsObject::from_proto_and_data(Some(function_prototype), ObjectData::function(func)); + JsObject::from_proto_and_data(function_prototype, ObjectData::function(func)); // Set constructor field to the newly created Value (function object) let constructor = PropertyDescriptor::builder() diff --git a/boa/src/object/jsobject.rs b/boa/src/object/jsobject.rs index 1c5a54aa0ae..adb66dab4bb 100644 --- a/boa/src/object/jsobject.rs +++ b/boa/src/object/jsobject.rs @@ -77,10 +77,10 @@ impl JsObject { /// Create a `JsObject` and automatically set its internal methods and /// internal slots from the `data` provided. #[inline] - pub fn from_proto_and_data(prototype: Option, data: ObjectData) -> Self { + pub fn from_proto_and_data>>(prototype: O, data: ObjectData) -> Self { Self::from_object(Object { data, - prototype: prototype.map_or(JsValue::Null, JsValue::new), + prototype: prototype.into().map_or(JsValue::Null, JsValue::new), extensible: true, properties: Default::default(), }) diff --git a/boa/src/object/mod.rs b/boa/src/object/mod.rs index c03bb1230df..c2d85637800 100644 --- a/boa/src/object/mod.rs +++ b/boa/src/object/mod.rs @@ -1204,12 +1204,10 @@ impl<'context> FunctionBuilder<'context> { #[inline] pub fn build(&mut self) -> JsObject { let function = JsObject::from_proto_and_data( - Some( - self.context - .standard_objects() - .function_object() - .prototype(), - ), + self.context + .standard_objects() + .function_object() + .prototype(), ObjectData::function(self.function.take().unwrap()), ); let property = PropertyDescriptor::builder() diff --git a/boa/src/value/mod.rs b/boa/src/value/mod.rs index 2bb128bcfcc..04268201727 100644 --- a/boa/src/value/mod.rs +++ b/boa/src/value/mod.rs @@ -521,31 +521,29 @@ impl JsValue { JsValue::Boolean(boolean) => { let prototype = context.standard_objects().boolean_object().prototype(); Ok(JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::boolean(*boolean), )) } JsValue::Integer(integer) => { let prototype = context.standard_objects().number_object().prototype(); Ok(JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::number(f64::from(*integer)), )) } JsValue::Rational(rational) => { let prototype = context.standard_objects().number_object().prototype(); Ok(JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::number(*rational), )) } JsValue::String(ref string) => { let prototype = context.standard_objects().string_object().prototype(); - let object = JsObject::from_proto_and_data( - Some(prototype), - ObjectData::string(string.clone()), - ); + let object = + JsObject::from_proto_and_data(prototype, ObjectData::string(string.clone())); // Make sure the correct length is set on our new string object object.insert_property( "length", @@ -560,14 +558,14 @@ impl JsValue { JsValue::Symbol(ref symbol) => { let prototype = context.standard_objects().symbol_object().prototype(); Ok(JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::symbol(symbol.clone()), )) } JsValue::BigInt(ref bigint) => { let prototype = context.standard_objects().bigint_object().prototype(); Ok(JsObject::from_proto_and_data( - Some(prototype), + prototype, ObjectData::big_int(bigint.clone()), )) } diff --git a/boa/src/vm/code_block.rs b/boa/src/vm/code_block.rs index 70f00756f79..87e101cd9e4 100644 --- a/boa/src/vm/code_block.rs +++ b/boa/src/vm/code_block.rs @@ -313,7 +313,7 @@ impl JsVmFunction { let function = Function::VmOrdinary { code, environment }; let constructor = - JsObject::from_proto_and_data(Some(function_prototype), ObjectData::function(function)); + JsObject::from_proto_and_data(function_prototype, ObjectData::function(function)); let constructor_property = PropertyDescriptor::builder() .value(constructor.clone()) @@ -522,12 +522,12 @@ impl JsObject { // prototype as prototype for the new object // see // see - let proto = get_prototype_from_constructor( + let prototype = get_prototype_from_constructor( this_target, StandardObjects::object_object, context, )?; - JsObject::from_proto_and_data(Some(proto), ObjectData::ordinary()).into() + JsObject::from_proto_and_data(prototype, ObjectData::ordinary()).into() }; let lexical_this_mode = code.this_mode == ThisMode::Lexical;