Skip to content

Commit

Permalink
Undo renaming from_proto_and_data
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Dec 27, 2022
1 parent d45ed7d commit 8e17229
Show file tree
Hide file tree
Showing 54 changed files with 93 additions and 93 deletions.
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/array/array_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl ArrayIterator {
kind: PropertyNameKind,
context: &Context,
) -> JsValue {
let array_iterator = JsObject::with_proto_and_data(
let array_iterator = JsObject::from_proto_and_data(
context
.intrinsics()
.objects()
Expand Down Expand Up @@ -141,7 +141,7 @@ impl ArrayIterator {

// Create prototype
let array_iterator =
JsObject::with_proto_and_data(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();
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl Array {
// 5. Set A.[[DefineOwnProperty]] as specified in 10.4.2.1.
let prototype =
prototype.unwrap_or_else(|| context.intrinsics().constructors().array().prototype());
let array = JsObject::with_proto_and_data(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(
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/array_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl ArrayBuffer {

// 3. Set obj.[[ArrayBufferData]] to block.
// 4. Set obj.[[ArrayBufferByteLength]] to byteLength.
let obj = JsObject::with_proto_and_data(
let obj = JsObject::from_proto_and_data(
prototype,
ObjectData::array_buffer(Self {
array_buffer_data: Some(block),
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/async_generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl AsyncGenerator {
.async_generator()
.prototype();

let this = JsObject::with_proto_and_data(
let this = JsObject::from_proto_and_data(
prototype,
ObjectData::async_generator(Self {
state: AsyncGeneratorState::Undefined,
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/boolean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Boolean {
}
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::boolean, context)?;
let boolean = JsObject::with_proto_and_data(prototype, ObjectData::boolean(data));
let boolean = JsObject::from_proto_and_data(prototype, ObjectData::boolean(data));

Ok(boolean.into())
}
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/dataview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl DataView {
.into());
}

let obj = JsObject::with_proto_and_data(
let obj = JsObject::from_proto_and_data(
prototype,
ObjectData::data_view(Self {
// 11. Set O.[[ViewedArrayBuffer]] to buffer.
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/date/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl Date {
get_prototype_from_constructor(new_target, StandardConstructors::date, context)?;

// 7. Set O.[[DateValue]] to dv.
let obj = JsObject::with_proto_and_data(prototype, ObjectData::date(dv));
let obj = JsObject::from_proto_and_data(prototype, ObjectData::date(dv));

// 8. Return O.
Ok(obj.into())
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/error/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl AggregateError {
StandardConstructors::aggregate_error,
context,
)?;
let o = JsObject::with_proto_and_data(prototype, ObjectData::error(ErrorKind::Aggregate));
let o = JsObject::from_proto_and_data(prototype, ObjectData::error(ErrorKind::Aggregate));

// 3. If message is not undefined, then
let message = args.get_or_undefined(1);
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/error/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl EvalError {
// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%NativeError.prototype%", « [[ErrorData]] »).
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::eval_error, context)?;
let o = JsObject::with_proto_and_data(prototype, ObjectData::error(ErrorKind::Eval));
let o = JsObject::from_proto_and_data(prototype, ObjectData::error(ErrorKind::Eval));

// 3. If message is not undefined, then
let message = args.get_or_undefined(0);
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl Error {
// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%Error.prototype%", « [[ErrorData]] »).
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::error, context)?;
let o = JsObject::with_proto_and_data(prototype, ObjectData::error(ErrorKind::Error));
let o = JsObject::from_proto_and_data(prototype, ObjectData::error(ErrorKind::Error));

// 3. If message is not undefined, then
let message = args.get_or_undefined(0);
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/error/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl RangeError {
// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%NativeError.prototype%", « [[ErrorData]] »).
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::range_error, context)?;
let o = JsObject::with_proto_and_data(prototype, ObjectData::error(ErrorKind::Range));
let o = JsObject::from_proto_and_data(prototype, ObjectData::error(ErrorKind::Range));

// 3. If message is not undefined, then
let message = args.get_or_undefined(0);
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/error/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl ReferenceError {
StandardConstructors::reference_error,
context,
)?;
let o = JsObject::with_proto_and_data(prototype, ObjectData::error(ErrorKind::Reference));
let o = JsObject::from_proto_and_data(prototype, ObjectData::error(ErrorKind::Reference));

// 3. If message is not undefined, then
let message = args.get_or_undefined(0);
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/error/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl SyntaxError {
StandardConstructors::syntax_error,
context,
)?;
let o = JsObject::with_proto_and_data(prototype, ObjectData::error(ErrorKind::Syntax));
let o = JsObject::from_proto_and_data(prototype, ObjectData::error(ErrorKind::Syntax));

// 3. If message is not undefined, then
let message = args.get_or_undefined(0);
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/error/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl TypeError {
// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%NativeError.prototype%", « [[ErrorData]] »).
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::type_error, context)?;
let o = JsObject::with_proto_and_data(prototype, ObjectData::error(ErrorKind::Type));
let o = JsObject::from_proto_and_data(prototype, ObjectData::error(ErrorKind::Type));

// 3. If message is not undefined, then
let message = args.get_or_undefined(0);
Expand All @@ -100,7 +100,7 @@ pub(crate) fn create_throw_type_error(context: &mut Context) -> JsObject {
Err(JsNativeError::typ().with_message("'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them").into())
}

let function = JsObject::with_proto_and_data(
let function = JsObject::from_proto_and_data(
context.intrinsics().constructors().function().prototype(),
ObjectData::function(Function::Native {
function: throw_type_error,
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/error/uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl UriError {
// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%NativeError.prototype%", « [[ErrorData]] »).
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::uri_error, context)?;
let o = JsObject::with_proto_and_data(prototype, ObjectData::error(ErrorKind::Uri));
let o = JsObject::from_proto_and_data(prototype, ObjectData::error(ErrorKind::Uri));

// 3. If message is not undefined, then
let message = args.get_or_undefined(0);
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/function/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl Arguments {
// 2. Let obj be ! OrdinaryObjectCreate(%Object.prototype%, « [[ParameterMap]] »).
// 3. Set obj.[[ParameterMap]] to undefined.
// skipped because the `Arguments` enum ensures ordinary argument objects don't have a `[[ParameterMap]]`
let obj = JsObject::with_proto_and_data(
let obj = JsObject::from_proto_and_data(
context.intrinsics().constructors().object().prototype(),
ObjectData::arguments(Self::Unmapped),
);
Expand Down Expand Up @@ -222,7 +222,7 @@ impl Arguments {
}

// 11. Set obj.[[ParameterMap]] to map.
let obj = JsObject::with_proto_and_data(
let obj = JsObject::from_proto_and_data(
context.intrinsics().constructors().object().prototype(),
ObjectData::arguments(Self::Mapped(map)),
);
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ pub(crate) fn make_builtin_fn<N>(
let name = name.into();
let _timer = Profiler::global().start_event(&format!("make_builtin_fn: {name}"), "init");

let function = JsObject::with_proto_and_data(
let function = JsObject::from_proto_and_data(
interpreter
.intrinsics()
.constructors()
Expand Down Expand Up @@ -1086,7 +1086,7 @@ impl BoundFunction {
// 8. Set obj.[[BoundThis]] to boundThis.
// 9. Set obj.[[BoundArguments]] to boundArgs.
// 10. Return obj.
Ok(JsObject::with_proto_and_data(
Ok(JsObject::from_proto_and_data(
proto,
ObjectData::bound_function(
Self {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl Generator {
) -> JsResult<JsValue> {
let prototype = context.intrinsics().constructors().generator().prototype();

let this = JsObject::with_proto_and_data(
let this = JsObject::from_proto_and_data(
prototype,
ObjectData::generator(Self {
state: GeneratorState::Undefined,
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/intl/collator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl Collator {

let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::collator, context)?;
let collator = JsObject::with_proto_and_data(
let collator = JsObject::from_proto_and_data(
prototype,
ObjectData::collator(Collator {
locale,
Expand Down Expand Up @@ -474,7 +474,7 @@ impl Collator {
})?;

// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
let options = JsObject::with_proto_and_data(
let options = JsObject::from_proto_and_data(
context.intrinsics().constructors().object().prototype(),
ObjectData::ordinary(),
);
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/intl/date_time_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl DateTimeFormat {
// « [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[Weekday]],
// [[Era]], [[Year]], [[Month]], [[Day]], [[DayPeriod]], [[Hour]], [[Minute]], [[Second]],
// [[FractionalSecondDigits]], [[TimeZoneName]], [[HourCycle]], [[Pattern]], [[BoundFormat]] »).
let date_time_format = JsObject::with_proto_and_data(
let date_time_format = JsObject::from_proto_and_data(
prototype,
ObjectData::date_time_format(Box::new(Self {
initialized_date_time_format: true,
Expand Down Expand Up @@ -169,7 +169,7 @@ pub(crate) fn to_date_time_options(
} else {
Some(options.to_object(context)?)
};
let options = JsObject::with_proto_and_data(options, ObjectData::ordinary());
let options = JsObject::from_proto_and_data(options, ObjectData::ordinary());

// 3. Let needDefaults be true.
let mut need_defaults = true;
Expand Down
6 changes: 3 additions & 3 deletions boa_engine/src/builtins/intl/list_format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl ListFormat {
// 2. Let listFormat be ? OrdinaryCreateFromConstructor(NewTarget, "%ListFormat.prototype%", « [[InitializedListFormat]], [[Locale]], [[Type]], [[Style]], [[Templates]] »).
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::list_format, context)?;
let list_format = JsObject::with_proto_and_data(
let list_format = JsObject::from_proto_and_data(
prototype,
ObjectData::list_format(ListFormat {
formatter: context
Expand Down Expand Up @@ -359,7 +359,7 @@ impl ListFormat {
// 4. For each Record { [[Type]], [[Value]] } part in parts, do
for (n, part) in parts.0.into_iter().enumerate() {
// a. Let O be OrdinaryObjectCreate(%Object.prototype%).
let o = JsObject::with_proto_and_data(
let o = JsObject::from_proto_and_data(
context.intrinsics().constructors().object().prototype(),
ObjectData::ordinary(),
);
Expand Down Expand Up @@ -407,7 +407,7 @@ impl ListFormat {
})?;

// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
let options = JsObject::with_proto_and_data(
let options = JsObject::from_proto_and_data(
context.intrinsics().constructors().object().prototype(),
ObjectData::ordinary(),
);
Expand Down
6 changes: 3 additions & 3 deletions boa_engine/src/builtins/intl/locale/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ impl Locale {
// 6. Let locale be ? OrdinaryCreateFromConstructor(NewTarget, "%Locale.prototype%", internalSlotsList).
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::locale, context)?;
let locale = JsObject::with_proto_and_data(prototype, ObjectData::locale(tag));
let locale = JsObject::from_proto_and_data(prototype, ObjectData::locale(tag));

// 37. Return locale.
Ok(locale.into())
Expand Down Expand Up @@ -380,7 +380,7 @@ impl Locale {

// 4. Return ! Construct(%Locale%, maximal).
let prototype = context.intrinsics().constructors().locale().prototype();
Ok(JsObject::with_proto_and_data(prototype, ObjectData::locale(loc)).into())
Ok(JsObject::from_proto_and_data(prototype, ObjectData::locale(loc)).into())
}

/// [`Intl.Locale.prototype.minimize ( )`][spec]
Expand Down Expand Up @@ -413,7 +413,7 @@ impl Locale {

// 4. Return ! Construct(%Locale%, minimal).
let prototype = context.intrinsics().constructors().locale().prototype();
Ok(JsObject::with_proto_and_data(prototype, ObjectData::locale(loc)).into())
Ok(JsObject::from_proto_and_data(prototype, ObjectData::locale(loc)).into())
}

/// [`Intl.Locale.prototype.toString ( )`][spec].
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/intl/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub(super) fn get_options_object(options: &JsValue) -> JsResult<JsObject> {
// If options is undefined, then
JsValue::Undefined => {
// a. Return OrdinaryObjectCreate(null).
Ok(JsObject::with_proto_and_data(None, ObjectData::ordinary()))
Ok(JsObject::from_proto_and_data(None, ObjectData::ordinary()))
}
// 2. If Type(options) is Object, then
JsValue::Object(obj) => {
Expand Down Expand Up @@ -244,7 +244,7 @@ pub(super) fn coerce_options_to_object(
// If options is undefined, then
if options.is_undefined() {
// a. Return OrdinaryObjectCreate(null).
return Ok(JsObject::with_proto_and_data(None, ObjectData::ordinary()));
return Ok(JsObject::from_proto_and_data(None, ObjectData::ordinary()));
}

// 2. Return ? ToObject(options).
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/iterable/async_from_sync_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use boa_profiler::Profiler;
pub(crate) fn create_async_from_sync_iterator_prototype(context: &mut Context) -> JsObject {
let _timer = Profiler::global().start_event("AsyncFromSyncIteratorPrototype", "init");

let prototype = JsObject::with_proto_and_data(
let prototype = JsObject::from_proto_and_data(
context
.intrinsics()
.objects()
Expand Down Expand Up @@ -99,7 +99,7 @@ impl AsyncFromSyncIterator {
) -> IteratorRecord {
// 1. Let asyncIterator be OrdinaryObjectCreate(%AsyncFromSyncIteratorPrototype%, « [[SyncIteratorRecord]] »).
// 2. Set asyncIterator.[[SyncIteratorRecord]] to syncIteratorRecord.
let async_iterator = JsObject::with_proto_and_data(
let async_iterator = JsObject::from_proto_and_data(
context
.intrinsics()
.objects()
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/map/map_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl MapIterator {
map_iteration_kind: kind,
lock,
};
let map_iterator = JsObject::with_proto_and_data(
let map_iterator = JsObject::from_proto_and_data(
context
.intrinsics()
.objects()
Expand Down Expand Up @@ -140,7 +140,7 @@ impl MapIterator {

// Create prototype
let map_iterator =
JsObject::with_proto_and_data(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();
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl Map {
// 3. Set map.[[MapData]] to a new empty List.
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::map, context)?;
let map = JsObject::with_proto_and_data(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) {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/number/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl Number {
}
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::number, context)?;
let this = JsObject::with_proto_and_data(prototype, ObjectData::number(data));
let this = JsObject::from_proto_and_data(prototype, ObjectData::number(data));
Ok(this.into())
}

Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/object/for_in_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,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::with_proto_and_data(
let for_in_iterator = JsObject::from_proto_and_data(
context
.intrinsics()
.objects()
Expand Down Expand Up @@ -141,7 +141,7 @@ impl ForInIterator {

// Create prototype
let for_in_iterator =
JsObject::with_proto_and_data(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();
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl Object {
// a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%Object.prototype%").
let prototype =
get_prototype_from_constructor(new_target, StandardConstructors::object, context)?;
let object = JsObject::with_proto_and_data(prototype, ObjectData::ordinary());
let object = JsObject::from_proto_and_data(prototype, ObjectData::ordinary());
return Ok(object.into());
}

Expand Down Expand Up @@ -405,7 +405,7 @@ impl Object {
let properties = args.get_or_undefined(1);

let obj = match prototype {
JsValue::Object(_) | JsValue::Null => JsObject::with_proto_and_data(
JsValue::Object(_) | JsValue::Null => JsObject::from_proto_and_data(
prototype.as_object().cloned(),
ObjectData::ordinary(),
),
Expand Down
Loading

0 comments on commit 8e17229

Please sign in to comment.