diff options
Diffstat (limited to 'Userland/Libraries')
32 files changed, 194 insertions, 192 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index b2391a9143..ab3a389cb0 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -697,7 +697,7 @@ ThrowCompletionOr<void> GetObjectPropertyIterator::execute_impl(Bytecode::Interp interpreter.realm(), [seen_items = HashTable<PropertyKey>(), items = move(properties)](VM& vm, GlobalObject& global_object) mutable -> ThrowCompletionOr<Value> { auto& realm = *global_object.associated_realm(); - auto iterated_object_value = vm.this_value(global_object); + auto iterated_object_value = vm.this_value(); if (!iterated_object_value.is_object()) return vm.throw_completion<InternalError>("Invalid state for GetObjectPropertyIterator.next"); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp index 0c936f0e9f..ffc9078d99 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp @@ -75,7 +75,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::is_view) // 25.1.4.3 get ArrayBuffer [ @@species ], https://tc39.es/ecma262/#sec-get-arraybuffer-@@species JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::symbol_species_getter) { - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp index 4f6351b00f..bb30a75c59 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp @@ -86,7 +86,7 @@ ThrowCompletionOr<Object*> ArrayConstructor::construct(FunctionObject& new_targe JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from) { auto& realm = *global_object.associated_realm(); - auto constructor = vm.this_value(global_object); + auto constructor = vm.this_value(); FunctionObject* map_fn = nullptr; if (!vm.argument(1).is_undefined()) { @@ -178,7 +178,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::is_array) JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::of) { auto& realm = *global_object.associated_realm(); - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); Object* array; if (this_value.is_constructor()) array = TRY(JS::construct(global_object, this_value.as_function(), Value(vm.argument_count()))); @@ -193,7 +193,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::of) // 23.1.2.5 get Array [ @@species ], https://tc39.es/ecma262/#sec-get-array-@@species JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::symbol_species_getter) { - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index 9e66aa5b81..869fea433a 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -152,7 +152,7 @@ static ThrowCompletionOr<Object*> array_species_create(GlobalObject& global_obje // 23.1.3.1 Array.prototype.at ( index ), https://tc39.es/ecma262/#sec-array.prototype.at JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::at) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); auto relative_index = TRY(vm.argument(0).to_integer_or_infinity(global_object)); if (Value(relative_index).is_infinity()) @@ -172,7 +172,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::at) // 23.1.3.2 Array.prototype.concat ( ...items ), https://tc39.es/ecma262/#sec-array.prototype.concat JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto* new_array = TRY(array_species_create(global_object, *this_object, 0)); @@ -230,7 +230,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat) // 23.1.3.4 Array.prototype.copyWithin ( target, start [ , end ] ), https://tc39.es/ecma262/#sec-array.prototype.copywithin JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::copy_within) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); auto relative_target = TRY(vm.argument(0).to_integer_or_infinity(global_object)); @@ -298,7 +298,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::entries) { auto& realm = *global_object.associated_realm(); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); return ArrayIterator::create(realm, this_object, Object::PropertyKind::KeyAndValue); } @@ -310,7 +310,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::every) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -351,7 +351,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::every) // 23.1.3.7 Array.prototype.fill ( value [ , start [ , end ] ] ), https://tc39.es/ecma262/#sec-array.prototype.fill JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::fill) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); @@ -396,7 +396,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::filter) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -454,7 +454,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -493,7 +493,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_index) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -532,7 +532,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -571,7 +571,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last_index) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -641,7 +641,7 @@ static ThrowCompletionOr<size_t> flatten_into_array(GlobalObject& global_object, // 23.1.3.13 Array.prototype.flat ( [ depth ] ), https://tc39.es/ecma262/#sec-array.prototype.flat JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::flat) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); @@ -664,7 +664,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::flat_map) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let sourceLen be ? LengthOfArrayLike(O). auto source_length = TRY(length_of_array_like(global_object, *object)); @@ -690,7 +690,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::for_each) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -761,7 +761,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::group) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *this_object)); @@ -817,7 +817,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::group_to_map) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *this_object)); @@ -884,7 +884,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::group_to_map) // 23.1.3.16 Array.prototype.includes ( searchElement [ , fromIndex ] ), https://tc39.es/ecma262/#sec-array.prototype.includes JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::includes) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); if (length == 0) return Value(false); @@ -919,7 +919,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of) auto from_index = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -987,7 +987,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of) // 23.1.3.18 Array.prototype.join ( separator ), https://tc39.es/ecma262/#sec-array.prototype.join JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::join) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); // This is not part of the spec, but all major engines do some kind of circular reference checks. // FWIW: engine262, a "100% spec compliant" ECMA-262 impl, aborts with "too much recursion". @@ -1022,7 +1022,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::keys) { auto& realm = *global_object.associated_realm(); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); return ArrayIterator::create(realm, this_object, Object::PropertyKind::Key); } @@ -1034,7 +1034,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of) auto from_index = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1102,7 +1102,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1145,7 +1145,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map) // 23.1.3.22 Array.prototype.pop ( ), https://tc39.es/ecma262/#sec-array.prototype.pop JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); if (length == 0) { TRY(this_object->set(vm.names.length, Value(0), Object::ShouldThrowExceptions::Yes)); @@ -1161,7 +1161,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop) // 23.1.3.23 Array.prototype.push ( ...items ), https://tc39.es/ecma262/#sec-array.prototype.push JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::push) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); auto argument_count = vm.argument_count(); auto new_length = length + argument_count; @@ -1181,7 +1181,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce) auto initial_value = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1263,7 +1263,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right) auto initial_value = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1341,7 +1341,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right) // 23.1.3.26 Array.prototype.reverse ( ), https://tc39.es/ecma262/#sec-array.prototype.reverse JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); auto middle = length / 2; @@ -1376,7 +1376,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse) // 23.1.3.27 Array.prototype.shift ( ), https://tc39.es/ecma262/#sec-array.prototype.shift JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); if (length == 0) { TRY(this_object->set(vm.names.length, Value(0), Object::ShouldThrowExceptions::Yes)); @@ -1403,7 +1403,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift) // 23.1.3.28 Array.prototype.slice ( start, end ), https://tc39.es/ecma262/#sec-array.prototype.slice JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::slice) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto initial_length = TRY(length_of_array_like(global_object, *this_object)); @@ -1463,7 +1463,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::some) auto this_arg = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1569,7 +1569,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::sort) return vm.throw_completion<TypeError>(ErrorType::NotAFunction, comparefn.to_string_without_side_effects()); // 2. Let obj be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 3. Let len be ? LengthOfArrayLike(obj). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1611,7 +1611,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::sort) // 23.1.3.31 Array.prototype.splice ( start, deleteCount, ...items ), https://tc39.es/ecma262/#sec-array.prototype.splice JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto initial_length = TRY(length_of_array_like(global_object, *this_object)); @@ -1703,7 +1703,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string) auto options = vm.argument(1); // 1. Let array be ? ToObject(this value). - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); if (s_array_join_seen_objects.contains(this_object)) return js_string(vm, ""); @@ -1756,7 +1756,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_reversed) auto& realm = *global_object.associated_realm(); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1798,7 +1798,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_sorted) return vm.throw_completion<TypeError>(ErrorType::NotAFunction, comparefn); // 2. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 3. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1837,7 +1837,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_spliced) auto delete_count = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); @@ -1963,7 +1963,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_spliced) JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_string) { // 1. Let array be ? ToObject(this value). - auto* array = TRY(vm.this_value(global_object).to_object(global_object)); + auto* array = TRY(vm.this_value().to_object(global_object)); // 2. Let func be ? Get(array, "join"). auto func = TRY(array->get(vm.names.join)); @@ -1979,7 +1979,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_string) // 23.1.3.34 Array.prototype.unshift ( ...items ), https://tc39.es/ecma262/#sec-array.prototype.unshift JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::unshift) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *this_object)); auto arg_count = vm.argument_count(); size_t new_length = length + arg_count; @@ -2013,7 +2013,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::values) { auto& realm = *global_object.associated_realm(); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); return ArrayIterator::create(realm, this_object, Object::PropertyKind::Value); } @@ -2027,7 +2027,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::with) auto value = vm.argument(1); // 1. Let O be ? ToObject(this value). - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 2. Let len be ? LengthOfArrayLike(O). auto length = TRY(length_of_array_like(global_object, *object)); diff --git a/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp index 87a8cc604a..508f35023d 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp @@ -25,7 +25,7 @@ void AsyncIteratorPrototype::initialize(Realm& realm) JS_DEFINE_NATIVE_FUNCTION(AsyncIteratorPrototype::symbol_async_iterator) { // 1. Return the this value. - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp index 9de1d8ff43..c829d5294c 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp @@ -49,7 +49,7 @@ static ThrowCompletionOr<BigInt*> this_bigint_value(GlobalObject& global_object, // 21.2.3.3 BigInt.prototype.toString ( [ radix ] ), https://tc39.es/ecma262/#sec-bigint.prototype.tostring JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_string) { - auto* bigint = TRY(this_bigint_value(global_object, vm.this_value(global_object))); + auto* bigint = TRY(this_bigint_value(global_object, vm.this_value())); double radix = 10; if (!vm.argument(0).is_undefined()) { radix = TRY(vm.argument(0).to_integer_or_infinity(global_object)); @@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_locale_string) auto options = vm.argument(1); // 1. Let x be ? thisBigIntValue(this value). - auto* bigint = TRY(this_bigint_value(global_object, vm.this_value(global_object))); + auto* bigint = TRY(this_bigint_value(global_object, vm.this_value())); // 2. Let numberFormat be ? Construct(%NumberFormat%, « locales, options »). auto* number_format = static_cast<Intl::NumberFormat*>(TRY(construct(global_object, *global_object.intl_number_format_constructor(), locales, options))); @@ -80,7 +80,7 @@ JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_locale_string) // 21.2.3.4 BigInt.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-bigint.prototype.valueof JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::value_of) { - return TRY(this_bigint_value(global_object, vm.this_value(global_object))); + return TRY(this_bigint_value(global_object, vm.this_value())); } } diff --git a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp index 2bf9922cc8..95ae6c21ae 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp @@ -29,7 +29,7 @@ void BooleanPrototype::initialize(Realm& realm) // 20.3.3.2 Boolean.prototype.toString ( ), https://tc39.es/ecma262/#sec-boolean.prototype.tostring JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string) { - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); if (this_value.is_boolean()) return js_string(vm, this_value.as_bool() ? "true" : "false"); if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) @@ -42,7 +42,7 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string) // 20.3.3.3 Boolean.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-boolean.prototype.valueof JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::value_of) { - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); if (this_value.is_boolean()) return this_value; if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp index 371b959160..b09602a42b 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -116,7 +116,7 @@ ThrowCompletionOr<double> this_time_value(GlobalObject& global_object, Value val JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_date) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -130,7 +130,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_date) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_day) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -144,7 +144,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_day) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_full_year) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -158,7 +158,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_full_year) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_hours) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -172,7 +172,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_hours) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_milliseconds) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -186,7 +186,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_milliseconds) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_minutes) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -200,7 +200,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_minutes) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_month) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -214,7 +214,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_month) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_seconds) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -228,14 +228,14 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_seconds) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_time) { // 1. Return ? thisTimeValue(this value). - return Value(TRY(this_time_value(global_object, vm.this_value(global_object)))); + return Value(TRY(this_time_value(global_object, vm.this_value()))); } // 21.4.4.11 Date.prototype.getTimezoneOffset ( ), https://tc39.es/ecma262/#sec-date.prototype.gettimezoneoffset JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_timezone_offset) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -249,7 +249,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_timezone_offset) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_date) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -263,7 +263,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_date) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_day) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -277,7 +277,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_day) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_full_year) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -291,7 +291,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_full_year) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_hours) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -305,7 +305,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_hours) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_milliseconds) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -319,7 +319,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_milliseconds) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_minutes) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -333,7 +333,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_minutes) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_month) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -347,7 +347,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_month) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_utc_seconds) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -381,7 +381,7 @@ static ThrowCompletionOr<Optional<double>> argument_or_empty(GlobalObject& globa JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_date) { // 1. Let t be ? thisTimeValue(this value). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let dt be ? ToNumber(date). auto date = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -415,7 +415,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_date) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_full_year) { // 1. Let t be ? thisTimeValue(this value). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let y be ? ToNumber(year). auto year = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -450,7 +450,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_full_year) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_hours) { // 1. Let t be LocalTime(? thisTimeValue(this value)). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let h be ? ToNumber(hour). auto hour = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -502,7 +502,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_hours) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_milliseconds) { // 1. Let t be ? thisTimeValue(this value). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. Set ms to ? ToNumber(ms). auto millisecond = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -537,7 +537,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_milliseconds) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_minutes) { // 1. Let t be ? thisTimeValue(this value). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let m be ? ToNumber(min). auto minute = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -584,7 +584,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_minutes) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_month) { // 1. Let t be ? thisTimeValue(this value). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let m be ? ToNumber(month). auto month = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -624,7 +624,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_month) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_seconds) { // 1. Let t be ? thisTimeValue(this value). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let s be ? ToNumber(sec). auto second = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -665,7 +665,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_seconds) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_time) { // 1. Perform ? thisTimeValue(this value). - TRY(this_time_value(global_object, vm.this_value(global_object))); + TRY(this_time_value(global_object, vm.this_value())); // 2. Let t be ? ToNumber(time). auto time = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -685,7 +685,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_time) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_date) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let dt be ? ToNumber(date). auto date = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -716,7 +716,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_date) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_full_year) { // 1. Let t be ? thisTimeValue(this value). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, set t to +0𝔽. double time = 0; @@ -751,7 +751,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_full_year) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_hours) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let h be ? ToNumber(hour). auto hour = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -800,7 +800,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_hours) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_milliseconds) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. Set ms to ? ToNumber(ms). auto millisecond = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -832,7 +832,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_milliseconds) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_minutes) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let m be ? ToNumber(min). auto minute = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -876,7 +876,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_minutes) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_month) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let m be ? ToNumber(month). auto month = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -913,7 +913,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_month) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_seconds) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. Let s be ? ToNumber(sec). auto second = TRY(vm.argument(0).to_number(global_object)).as_double(); @@ -952,7 +952,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_date_string) { // 1. Let O be this Date object. // 2. Let tv be ? thisTimeValue(O). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 3. If tv is NaN, return "Invalid Date". if (isnan(time)) @@ -978,7 +978,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_iso_string) // 21.4.4.37 Date.prototype.toJSON ( key ), https://tc39.es/ecma262/#sec-date.prototype.tojson JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_json) { - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); auto time_value = TRY(this_value.to_primitive(global_object, Value::PreferredType::Number)); @@ -1002,7 +1002,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_date_string) auto options = vm.argument(1); // 1. Let x be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If x is NaN, return "Invalid Date". if (isnan(time)) @@ -1027,7 +1027,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_string) auto options = vm.argument(1); // 1. Let x be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If x is NaN, return "Invalid Date". if (isnan(time)) @@ -1052,7 +1052,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_time_string) auto options = vm.argument(1); // 1. Let x be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If x is NaN, return "Invalid Date". if (isnan(time)) @@ -1073,7 +1073,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_locale_time_string) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_string) { // 1. Let tv be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. Return ToDateString(tv). return js_string(vm, JS::to_date_string(time)); @@ -1177,7 +1177,7 @@ String to_date_string(double time) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_temporal_instant) { // 1. Let t be ? thisTimeValue(this value). - auto t = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto t = TRY(this_time_value(global_object, vm.this_value())); // 2. Let ns be ? NumberToBigInt(t) × ℤ(10^6). auto* ns = TRY(number_to_bigint(global_object, Value(t))); @@ -1192,7 +1192,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_time_string) { // 1. Let O be this Date object. // 2. Let tv be ? thisTimeValue(O). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 3. If tv is NaN, return "Invalid Date". if (isnan(time)) @@ -1209,7 +1209,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_utc_string) { // 1. Let O be this Date object. // 2. Let tv be ? thisTimeValue(O). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 3. If tv is NaN, return "Invalid Date". if (isnan(time)) @@ -1239,7 +1239,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_utc_string) // 21.4.4.45 Date.prototype [ @@toPrimitive ] ( hint ), https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive JS_DEFINE_NATIVE_FUNCTION(DatePrototype::symbol_to_primitive) { - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); if (!this_value.is_object()) return vm.throw_completion<TypeError>(ErrorType::NotAnObject, this_value.to_string_without_side_effects()); auto hint_value = vm.argument(0); @@ -1260,7 +1260,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::symbol_to_primitive) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_year) { // 1. Let t be ? thisTimeValue(this value). - auto time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, return NaN. if (isnan(time)) @@ -1274,7 +1274,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::get_year) JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_year) { // 1. Let t be ? thisTimeValue(this value). - auto this_time = TRY(this_time_value(global_object, vm.this_value(global_object))); + auto this_time = TRY(this_time_value(global_object, vm.this_value())); // 2. If t is NaN, set t to +0𝔽; otherwise, set t to LocalTime(t). double time = 0; diff --git a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp index f5ea250684..9daf1f917f 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -106,7 +106,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_getter) JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_setter) { // 1. Let E be the this value. - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); // 2. If ! Type(E) is not Object, throw a TypeError exception. if (!this_value.is_object()) diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp index 248d135938..6b710cdd9a 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -50,7 +50,7 @@ ThrowCompletionOr<Value> FunctionPrototype::internal_call(Value, MarkedVector<Va JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply) { // 1. Let func be the this value. - auto function_value = vm.this_value(global_object); + auto function_value = vm.this_value(); // 2. If IsCallable(func) is false, throw a TypeError exception. if (!function_value.is_function()) @@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind) auto this_argument = vm.argument(0); // 1. Let Target be the this value. - auto target_value = vm.this_value(global_object); + auto target_value = vm.this_value(); // 2. If IsCallable(Target) is false, throw a TypeError exception. if (!target_value.is_function()) @@ -118,7 +118,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind) JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call) { // 1. Let func be the this value. - auto function_value = vm.this_value(global_object); + auto function_value = vm.this_value(); // 2. If IsCallable(func) is false, throw a TypeError exception. if (!function_value.is_function()) @@ -143,7 +143,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call) JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string) { // 1. Let func be the this value. - auto function_value = vm.this_value(global_object); + auto function_value = vm.this_value(); // If func is not a function, let's bail out early. The order of this step is not observable. if (!function_value.is_function()) { @@ -175,7 +175,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string) // 20.2.3.6 Function.prototype [ @@hasInstance ] ( V ), https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::symbol_has_instance) { - return TRY(ordinary_has_instance(global_object, vm.argument(0), vm.this_value(global_object))); + return TRY(ordinary_has_instance(global_object, vm.argument(0), vm.this_value())); } } diff --git a/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp index 25df088632..1f68bdbcc2 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp @@ -28,7 +28,7 @@ void IteratorPrototype::initialize(Realm& realm) JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::symbol_iterator) { // 1. Return the this value. - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp index 45b414d9c1..c57e0d52e8 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -70,7 +70,7 @@ ThrowCompletionOr<Object*> MapConstructor::construct(FunctionObject& new_target) // 24.1.2.2 get Map [ @@species ], https://tc39.es/ecma262/#sec-get-map-@@species JS_DEFINE_NATIVE_FUNCTION(MapConstructor::symbol_species_getter) { - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp index eb053c80e8..0dd2f8ec45 100644 --- a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp @@ -70,7 +70,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::for_each) auto* map = TRY(typed_this_object(global_object)); if (!vm.argument(0).is_function()) return vm.throw_completion<TypeError>(ErrorType::NotAFunction, vm.argument(0).to_string_without_side_effects()); - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); for (auto& entry : *map) TRY(call(global_object, vm.argument(0).as_function(), vm.argument(1), entry.value, entry.key, this_value)); return js_undefined(); diff --git a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp index 5415e12a5c..1a36863e85 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp @@ -128,7 +128,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_exponential) auto fraction_digits_value = vm.argument(0); // 1. Let x be ? thisNumberValue(this value). - auto number_value = TRY(this_number_value(global_object, vm.this_value(global_object))); + auto number_value = TRY(this_number_value(global_object, vm.this_value())); // 2. Let f be ? ToIntegerOrInfinity(fractionDigits). auto fraction_digits = TRY(fraction_digits_value.to_integer_or_infinity(global_object)); @@ -247,7 +247,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_exponential) JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_fixed) { // 1. Let x be ? thisNumberValue(this value). - auto number_value = TRY(this_number_value(global_object, vm.this_value(global_object))); + auto number_value = TRY(this_number_value(global_object, vm.this_value())); // 2. Let f be ? ToIntegerOrInfinity(fractionDigits). // 3. Assert: If fractionDigits is undefined, then f is 0. @@ -324,7 +324,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_locale_string) auto options = vm.argument(1); // 1. Let x be ? thisNumberValue(this value). - auto number_value = TRY(this_number_value(global_object, vm.this_value(global_object))); + auto number_value = TRY(this_number_value(global_object, vm.this_value())); // 2. Let numberFormat be ? Construct(%NumberFormat%, « locales, options »). auto* number_format = static_cast<Intl::NumberFormat*>(TRY(construct(global_object, *global_object.intl_number_format_constructor(), locales, options))); @@ -341,7 +341,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_precision) auto precision_value = vm.argument(0); // 1. Let x be ? thisNumberValue(this value). - auto number_value = TRY(this_number_value(global_object, vm.this_value(global_object))); + auto number_value = TRY(this_number_value(global_object, vm.this_value())); // 2. If precision is undefined, return ! ToString(x). if (precision_value.is_undefined()) @@ -471,7 +471,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_precision) JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string) { // 1. Let x be ? thisNumberValue(this value). - auto number_value = TRY(this_number_value(global_object, vm.this_value(global_object))); + auto number_value = TRY(this_number_value(global_object, vm.this_value())); double radix_mv; @@ -553,7 +553,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string) JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::value_of) { // 1. Return ? thisNumberValue(this value). - return this_number_value(global_object, vm.this_value(global_object)); + return this_number_value(global_object, vm.this_value()); } } diff --git a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp index 56b811e4b9..7c85eb43a2 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -59,14 +59,14 @@ ThrowCompletionOr<bool> ObjectPrototype::internal_set_prototype_of(Object* proto JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::has_own_property) { auto property_key = TRY(vm.argument(0).to_property_key(global_object)); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); return Value(TRY(this_object->has_own_property(property_key))); } // 20.1.3.6 Object.prototype.toString ( ), https://tc39.es/ecma262/#sec-object.prototype.tostring JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string) { - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); // 1. If the this value is undefined, return "[object Undefined]". if (this_value.is_undefined()) @@ -134,14 +134,14 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string) // 20.1.3.5 Object.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-object.prototype.tolocalestring JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_locale_string) { - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); return this_value.invoke(global_object, vm.names.toString); } // 20.1.3.7 Object.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-object.prototype.valueof JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::value_of) { - return TRY(vm.this_value(global_object).to_object(global_object)); + return TRY(vm.this_value().to_object(global_object)); } // 20.1.3.4 Object.prototype.propertyIsEnumerable ( V ), https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable @@ -150,7 +150,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::property_is_enumerable) // 1. Let P be ? ToPropertyKey(V). auto property_key = TRY(vm.argument(0).to_property_key(global_object)); // 2. Let O be ? ToObject(this value). - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); // 3. Let desc be ? O.[[GetOwnProperty]](P). auto property_descriptor = TRY(this_object->internal_get_own_property(property_key)); // 4. If desc is undefined, return false. @@ -167,7 +167,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::is_prototype_of) if (!object_argument.is_object()) return Value(false); auto* object = &object_argument.as_object(); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); for (;;) { object = TRY(object->internal_get_prototype_of()); @@ -181,7 +181,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::is_prototype_of) // B.2.2.2 Object.prototype.__defineGetter__ ( P, getter ), https://tc39.es/ecma262/#sec-object.prototype.__defineGetter__ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_getter) { - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); auto getter = vm.argument(1); if (!getter.is_function()) @@ -199,7 +199,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_getter) // B.2.2.3 Object.prototype.__defineSetter__ ( P, getter ), https://tc39.es/ecma262/#sec-object.prototype.__defineSetter__ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_setter) { - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); auto setter = vm.argument(1); if (!setter.is_function()) @@ -217,7 +217,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_setter) // B.2.2.4 Object.prototype.__lookupGetter__ ( P ), https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::lookup_getter) { - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); auto key = TRY(vm.argument(0).to_property_key(global_object)); @@ -237,7 +237,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::lookup_getter) // B.2.2.5 Object.prototype.__lookupSetter__ ( P ), https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::lookup_setter) { - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); auto key = TRY(vm.argument(0).to_property_key(global_object)); @@ -257,14 +257,14 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::lookup_setter) // B.2.2.1.1 get Object.prototype.__proto__, https://tc39.es/ecma262/#sec-get-object.prototype.__proto__ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::proto_getter) { - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); return TRY(object->internal_get_prototype_of()); } // B.2.2.1.2 set Object.prototype.__proto__, https://tc39.es/ecma262/#sec-set-object.prototype.__proto__ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::proto_setter) { - auto object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto object = TRY(require_object_coercible(global_object, vm.this_value())); auto proto = vm.argument(0); if (!proto.is_object() && !proto.is_null()) diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index 3026aba2f9..d956aa90d5 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -321,7 +321,7 @@ ThrowCompletionOr<Object*> PromiseConstructor::construct(FunctionObject& new_tar JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all) { // 1. Let C be the this value. - auto* constructor = TRY(vm.this_value(global_object).to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(global_object)); // 2. Let promiseCapability be ? NewPromiseCapability(C). auto promise_capability = TRY(new_promise_capability(global_object, constructor)); @@ -355,7 +355,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all) JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all_settled) { // 1. Let C be the this value. - auto* constructor = TRY(vm.this_value(global_object).to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(global_object)); // 2. Let promiseCapability be ? NewPromiseCapability(C). auto promise_capability = TRY(new_promise_capability(global_object, constructor)); @@ -389,7 +389,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::all_settled) JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::any) { // 1. Let C be the this value. - auto* constructor = TRY(vm.this_value(global_object).to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(global_object)); // 2. Let promiseCapability be ? NewPromiseCapability(C). auto promise_capability = TRY(new_promise_capability(global_object, constructor)); @@ -423,7 +423,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::any) JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::race) { // 1. Let C be the this value. - auto* constructor = TRY(vm.this_value(global_object).to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(global_object)); // 2. Let promiseCapability be ? NewPromiseCapability(C). auto promise_capability = TRY(new_promise_capability(global_object, constructor)); @@ -459,7 +459,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::reject) auto reason = vm.argument(0); // 1. Let C be the this value. - auto* constructor = TRY(vm.this_value(global_object).to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(global_object)); // 2. Let promiseCapability be ? NewPromiseCapability(C). auto promise_capability = TRY(new_promise_capability(global_object, constructor)); @@ -477,7 +477,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::resolve) auto value = vm.argument(0); // 1. Let C be the this value. - auto constructor = vm.this_value(global_object); + auto constructor = vm.this_value(); // 2. If Type(C) is not Object, throw a TypeError exception. if (!constructor.is_object()) @@ -491,7 +491,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::resolve) JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::symbol_species_getter) { // 1. Return the this value. - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp index 413710abf2..fc3e9992da 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp @@ -61,7 +61,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::catch_) auto on_rejected = vm.argument(0); // 1. Let promise be the this value. - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); // 2. Return ? Invoke(promise, "then", « undefined, onRejected »). return TRY(this_value.invoke(global_object, vm.names.then, js_undefined(), on_rejected)); @@ -75,7 +75,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::finally) auto on_finally = vm.argument(0); // 1. Let promise be the this value. - auto promise = vm.this_value(global_object); + auto promise = vm.this_value(); // 2. If Type(promise) is not Object, throw a TypeError exception. if (!promise.is_object()) diff --git a/Userland/Libraries/LibJS/Runtime/PrototypeObject.h b/Userland/Libraries/LibJS/Runtime/PrototypeObject.h index e88afea667..d6adf4c865 100644 --- a/Userland/Libraries/LibJS/Runtime/PrototypeObject.h +++ b/Userland/Libraries/LibJS/Runtime/PrototypeObject.h @@ -29,7 +29,7 @@ public: static ThrowCompletionOr<Object*> this_object(GlobalObject& global_object) { auto& vm = global_object.vm(); - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); if (!this_value.is_object()) return vm.throw_completion<TypeError>(ErrorType::NotAnObject, this_value); return &this_value.as_object(); @@ -39,7 +39,7 @@ public: static ThrowCompletionOr<ObjectType*> typed_this_object(GlobalObject& global_object) { auto& vm = global_object.vm(); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); if (!is<ObjectType>(this_object)) return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, PrototypeType::display_name()); return static_cast<ObjectType*>(this_object); @@ -49,7 +49,7 @@ public: static ThrowCompletionOr<ObjectType*> typed_this_value(GlobalObject& global_object) { auto& vm = global_object.vm(); - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); if (!this_value.is_object() || !is<ObjectType>(this_value.as_object())) return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, PrototypeType::display_name()); return static_cast<ObjectType*>(&this_value.as_object()); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp index ae77053e5b..23eab3b864 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp @@ -90,7 +90,7 @@ ThrowCompletionOr<Object*> RegExpConstructor::construct(FunctionObject&) // 22.2.4.2 get RegExp [ @@species ], https://tc39.es/ecma262/#sec-get-regexp-@@species JS_DEFINE_NATIVE_FUNCTION(RegExpConstructor::symbol_species_getter) { - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp b/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp index d2cdf4b0a0..a1f099e2f2 100644 --- a/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp @@ -64,7 +64,7 @@ ThrowCompletionOr<Object*> SetConstructor::construct(FunctionObject& new_target) // 24.2.2.2 get Set [ @@species ], https://tc39.es/ecma262/#sec-get-set-@@species JS_DEFINE_NATIVE_FUNCTION(SetConstructor::symbol_species_getter) { - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp index cf3eba25ab..73620f7f6e 100644 --- a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp @@ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::for_each) auto* set = TRY(typed_this_object(global_object)); if (!vm.argument(0).is_function()) return vm.throw_completion<TypeError>(ErrorType::NotAFunction, vm.argument(0).to_string_without_side_effects()); - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); for (auto& entry : *set) TRY(call(global_object, vm.argument(0).as_function(), vm.argument(1), entry.key, entry.key, this_value)); return js_undefined(); diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index d48bfda8be..35481904fc 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -34,13 +34,13 @@ namespace JS { static ThrowCompletionOr<String> ak_string_from(VM& vm, GlobalObject& global_object) { - auto this_value = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto this_value = TRY(require_object_coercible(global_object, vm.this_value())); return TRY(this_value.to_string(global_object)); } static ThrowCompletionOr<Utf16String> utf16_string_from(VM& vm, GlobalObject& global_object) { - auto this_value = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto this_value = TRY(require_object_coercible(global_object, vm.this_value())); return TRY(this_value.to_utf16_string(global_object)); } @@ -424,13 +424,13 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::to_uppercase) // 22.1.3.28 String.prototype.toString ( ), https://tc39.es/ecma262/#sec-string.prototype.tostring JS_DEFINE_NATIVE_FUNCTION(StringPrototype::to_string) { - return TRY(this_string_value(global_object, vm.this_value(global_object))); + return TRY(this_string_value(global_object, vm.this_value())); } // 22.1.3.33 String.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-string.prototype.valueof JS_DEFINE_NATIVE_FUNCTION(StringPrototype::value_of) { - return TRY(this_string_value(global_object, vm.this_value(global_object))); + return TRY(this_string_value(global_object, vm.this_value())); } enum class PadPlacement { @@ -507,26 +507,26 @@ ThrowCompletionOr<String> trim_string(GlobalObject& global_object, Value input_v // 22.1.3.30 String.prototype.trim ( ), https://tc39.es/ecma262/#sec-string.prototype.trim JS_DEFINE_NATIVE_FUNCTION(StringPrototype::trim) { - return js_string(vm, TRY(trim_string(global_object, vm.this_value(global_object), TrimMode::Both))); + return js_string(vm, TRY(trim_string(global_object, vm.this_value(), TrimMode::Both))); } // 22.1.3.32 String.prototype.trimStart ( ), https://tc39.es/ecma262/#sec-string.prototype.trimstart JS_DEFINE_NATIVE_FUNCTION(StringPrototype::trim_start) { - return js_string(vm, TRY(trim_string(global_object, vm.this_value(global_object), TrimMode::Left))); + return js_string(vm, TRY(trim_string(global_object, vm.this_value(), TrimMode::Left))); } // 22.1.3.31 String.prototype.trimEnd ( ), https://tc39.es/ecma262/#sec-string.prototype.trimend JS_DEFINE_NATIVE_FUNCTION(StringPrototype::trim_end) { - return js_string(vm, TRY(trim_string(global_object, vm.this_value(global_object), TrimMode::Right))); + return js_string(vm, TRY(trim_string(global_object, vm.this_value(), TrimMode::Right))); } // 22.1.3.5 String.prototype.concat ( ...args ), https://tc39.es/ecma262/#sec-string.prototype.concat JS_DEFINE_NATIVE_FUNCTION(StringPrototype::concat) { // 1. Let O be ? RequireObjectCoercible(this value). - auto object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto object = TRY(require_object_coercible(global_object, vm.this_value())); // 2. Let S be ? ToString(O). auto* string = TRY(object.to_primitive_string(global_object)); @@ -652,7 +652,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::split) { auto& realm = *global_object.associated_realm(); - auto object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto object = TRY(require_object_coercible(global_object, vm.this_value())); auto separator_argument = vm.argument(0); auto limit_argument = vm.argument(1); @@ -775,7 +775,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::symbol_iterator) { auto& realm = *global_object.associated_realm(); - auto this_object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto this_object = TRY(require_object_coercible(global_object, vm.this_value())); auto string = TRY(this_object.to_string(global_object)); return StringIterator::create(realm, string); } @@ -783,7 +783,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::symbol_iterator) // 22.1.3.12 String.prototype.match ( regexp ), https://tc39.es/ecma262/#sec-string.prototype.match JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match) { - auto this_object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto this_object = TRY(require_object_coercible(global_object, vm.this_value())); auto regexp = vm.argument(0); if (!regexp.is_nullish()) { if (auto* matcher = TRY(regexp.get_method(global_object, *vm.well_known_symbol_match()))) @@ -799,7 +799,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match) // 22.1.3.13 String.prototype.matchAll ( regexp ), https://tc39.es/ecma262/#sec-string.prototype.matchall JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match_all) { - auto this_object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto this_object = TRY(require_object_coercible(global_object, vm.this_value())); auto regexp = vm.argument(0); if (!regexp.is_nullish()) { auto is_regexp = TRY(regexp.is_regexp(global_object)); @@ -848,7 +848,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::normalize) // 22.1.3.18 String.prototype.replace ( searchValue, replaceValue ), https://tc39.es/ecma262/#sec-string.prototype.replace JS_DEFINE_NATIVE_FUNCTION(StringPrototype::replace) { - auto this_object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto this_object = TRY(require_object_coercible(global_object, vm.this_value())); auto search_value = vm.argument(0); auto replace_value = vm.argument(1); @@ -890,7 +890,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::replace) // 22.1.3.19 String.prototype.replaceAll ( searchValue, replaceValue ), https://tc39.es/ecma262/#sec-string.prototype.replaceall JS_DEFINE_NATIVE_FUNCTION(StringPrototype::replace_all) { - auto this_object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto this_object = TRY(require_object_coercible(global_object, vm.this_value())); auto search_value = vm.argument(0); auto replace_value = vm.argument(1); @@ -959,7 +959,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::replace_all) // 22.1.3.20 String.prototype.search ( regexp ), https://tc39.es/ecma262/#sec-string.prototype.search JS_DEFINE_NATIVE_FUNCTION(StringPrototype::search) { - auto this_object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto this_object = TRY(require_object_coercible(global_object, vm.this_value())); auto regexp = vm.argument(0); if (!regexp.is_nullish()) { if (auto* searcher = TRY(regexp.get_method(global_object, *vm.well_known_symbol_search()))) @@ -1000,79 +1000,79 @@ static ThrowCompletionOr<Value> create_html(GlobalObject& global_object, Value s // B.2.2.2 String.prototype.anchor ( name ), https://tc39.es/ecma262/#sec-string.prototype.anchor JS_DEFINE_NATIVE_FUNCTION(StringPrototype::anchor) { - return create_html(global_object, vm.this_value(global_object), "a", "name", vm.argument(0)); + return create_html(global_object, vm.this_value(), "a", "name", vm.argument(0)); } // B.2.2.3 String.prototype.big ( ), https://tc39.es/ecma262/#sec-string.prototype.big JS_DEFINE_NATIVE_FUNCTION(StringPrototype::big) { - return create_html(global_object, vm.this_value(global_object), "big", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "big", String::empty(), Value()); } // B.2.2.4 String.prototype.blink ( ), https://tc39.es/ecma262/#sec-string.prototype.blink JS_DEFINE_NATIVE_FUNCTION(StringPrototype::blink) { - return create_html(global_object, vm.this_value(global_object), "blink", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "blink", String::empty(), Value()); } // B.2.2.5 String.prototype.bold ( ), https://tc39.es/ecma262/#sec-string.prototype.bold JS_DEFINE_NATIVE_FUNCTION(StringPrototype::bold) { - return create_html(global_object, vm.this_value(global_object), "b", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "b", String::empty(), Value()); } // B.2.2.6 String.prototype.fixed ( ), https://tc39.es/ecma262/#sec-string.prototype.fixed JS_DEFINE_NATIVE_FUNCTION(StringPrototype::fixed) { - return create_html(global_object, vm.this_value(global_object), "tt", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "tt", String::empty(), Value()); } // B.2.2.7 String.prototype.fontcolor ( color ), https://tc39.es/ecma262/#sec-string.prototype.fontcolor JS_DEFINE_NATIVE_FUNCTION(StringPrototype::fontcolor) { - return create_html(global_object, vm.this_value(global_object), "font", "color", vm.argument(0)); + return create_html(global_object, vm.this_value(), "font", "color", vm.argument(0)); } // B.2.2.8 String.prototype.fontsize ( size ), https://tc39.es/ecma262/#sec-string.prototype.fontsize JS_DEFINE_NATIVE_FUNCTION(StringPrototype::fontsize) { - return create_html(global_object, vm.this_value(global_object), "font", "size", vm.argument(0)); + return create_html(global_object, vm.this_value(), "font", "size", vm.argument(0)); } // B.2.2.9 String.prototype.italics ( ), https://tc39.es/ecma262/#sec-string.prototype.italics JS_DEFINE_NATIVE_FUNCTION(StringPrototype::italics) { - return create_html(global_object, vm.this_value(global_object), "i", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "i", String::empty(), Value()); } // B.2.2.10 String.prototype.link ( url ), https://tc39.es/ecma262/#sec-string.prototype.link JS_DEFINE_NATIVE_FUNCTION(StringPrototype::link) { - return create_html(global_object, vm.this_value(global_object), "a", "href", vm.argument(0)); + return create_html(global_object, vm.this_value(), "a", "href", vm.argument(0)); } // B.2.2.11 String.prototype.small ( ), https://tc39.es/ecma262/#sec-string.prototype.small JS_DEFINE_NATIVE_FUNCTION(StringPrototype::small) { - return create_html(global_object, vm.this_value(global_object), "small", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "small", String::empty(), Value()); } // B.2.2.12 String.prototype.strike ( ), https://tc39.es/ecma262/#sec-string.prototype.strike JS_DEFINE_NATIVE_FUNCTION(StringPrototype::strike) { - return create_html(global_object, vm.this_value(global_object), "strike", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "strike", String::empty(), Value()); } // B.2.2.13 String.prototype.sub ( ), https://tc39.es/ecma262/#sec-string.prototype.sub JS_DEFINE_NATIVE_FUNCTION(StringPrototype::sub) { - return create_html(global_object, vm.this_value(global_object), "sub", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "sub", String::empty(), Value()); } // B.2.2.14 String.prototype.sup ( ), https://tc39.es/ecma262/#sec-string.prototype.sup JS_DEFINE_NATIVE_FUNCTION(StringPrototype::sup) { - return create_html(global_object, vm.this_value(global_object), "sup", String::empty(), Value()); + return create_html(global_object, vm.this_value(), "sup", String::empty(), Value()); } // 22.1.3.11 String.prototype.localeCompare ( that [ , reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-string.prototype.localecompare @@ -1080,7 +1080,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::sup) JS_DEFINE_NATIVE_FUNCTION(StringPrototype::locale_compare) { // 1. Let O be ? RequireObjectCoercible(this value). - auto object = TRY(require_object_coercible(global_object, vm.this_value(global_object))); + auto object = TRY(require_object_coercible(global_object, vm.this_value())); // 2. Let S be ? ToString(O). auto string = TRY(object.to_string(global_object)); diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp index 38791041db..2ee9f50447 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp @@ -51,7 +51,7 @@ static ThrowCompletionOr<Symbol*> this_symbol_value(GlobalObject& global_object, // 20.4.3.2 get Symbol.prototype.description, https://tc39.es/ecma262/#sec-symbol.prototype.description JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::description_getter) { - auto* symbol = TRY(this_symbol_value(global_object, vm.this_value(global_object))); + auto* symbol = TRY(this_symbol_value(global_object, vm.this_value())); auto& description = symbol->raw_description(); if (!description.has_value()) return js_undefined(); @@ -61,21 +61,21 @@ JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::description_getter) // 20.4.3.3 Symbol.prototype.toString ( ), https://tc39.es/ecma262/#sec-symbol.prototype.tostring JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::to_string) { - auto* symbol = TRY(this_symbol_value(global_object, vm.this_value(global_object))); + auto* symbol = TRY(this_symbol_value(global_object, vm.this_value())); return js_string(vm, symbol->to_string()); } // 20.4.3.4 Symbol.prototype.valueOf ( ), https://tc39.es/ecma262/#sec-symbol.prototype.valueof JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::value_of) { - return TRY(this_symbol_value(global_object, vm.this_value(global_object))); + return TRY(this_symbol_value(global_object, vm.this_value())); } // 20.4.3.5 Symbol.prototype [ @@toPrimitive ] ( hint ), https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive JS_DEFINE_NATIVE_FUNCTION(SymbolPrototype::symbol_to_primitive) { // The hint argument is ignored. - return TRY(this_symbol_value(global_object, vm.this_value(global_object))); + return TRY(this_symbol_value(global_object, vm.this_value())); } } diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index 21b4292994..a6baf0022a 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -53,7 +53,7 @@ ThrowCompletionOr<Object*> TypedArrayConstructor::construct(FunctionObject&) // 23.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ), https://tc39.es/ecma262/#sec-%typedarray%.from JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) { - auto constructor = vm.this_value(global_object); + auto constructor = vm.this_value(); if (!constructor.is_constructor()) return vm.throw_completion<TypeError>(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); @@ -113,7 +113,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::of) { auto length = vm.argument_count(); - auto constructor = vm.this_value(global_object); + auto constructor = vm.this_value(); if (!constructor.is_constructor()) return vm.throw_completion<TypeError>(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); MarkedVector<Value> arguments(vm.heap()); @@ -127,7 +127,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::of) // 23.2.2.4 get %TypedArray% [ @@species ], https://tc39.es/ecma262/#sec-get-%typedarray%-@@species JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::symbol_species_getter) { - return vm.this_value(global_object); + return vm.this_value(); } } diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index bf5100e3a1..f1a2a18412 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -73,7 +73,7 @@ void TypedArrayPrototype::initialize(Realm& realm) static ThrowCompletionOr<TypedArrayBase*> typed_array_from_this(GlobalObject& global_object) { - auto this_value = global_object.vm().this_value(global_object); + auto this_value = global_object.vm().this_value(); return typed_array_from(global_object, this_value); } @@ -1522,7 +1522,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::to_sorted) return vm.throw_completion<TypeError>(ErrorType::NotAFunction, comparefn); // 2. Let O be the this value. - auto* object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* object = TRY(vm.this_value().to_object(global_object)); // 3. Perform ? ValidateTypedArray(O). auto* typed_array = TRY(validate_typed_array_from_this(global_object)); @@ -1635,7 +1635,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::values) // 23.2.3.35 get %TypedArray%.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-get-%typedarray%.prototype-@@tostringtag JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::to_string_tag_getter) { - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); if (!this_value.is_object()) return js_undefined(); auto& this_object = this_value.as_object(); diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index cc9ab74bb9..d5175be6fe 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -63,8 +63,11 @@ public: void gather_roots(HashTable<Cell*>&); -#define __JS_ENUMERATE(SymbolName, snake_name) \ - Symbol* well_known_symbol_##snake_name() const { return m_well_known_symbol_##snake_name; } +#define __JS_ENUMERATE(SymbolName, snake_name) \ + Symbol* well_known_symbol_##snake_name() const \ + { \ + return m_well_known_symbol_##snake_name; \ + } JS_ENUMERATE_WELL_KNOWN_SYMBOLS #undef __JS_ENUMERATE @@ -144,10 +147,9 @@ public: return index < arguments.size() ? arguments[index] : js_undefined(); } - Value this_value(Object& global_object) const + Value this_value() const { - if (m_execution_context_stack.is_empty()) - return &global_object; + VERIFY(!m_execution_context_stack.is_empty()); return running_execution_context().this_value; } diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp index b2b16cb58d..bc9c15c256 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -76,7 +76,7 @@ AK::URL LocationObject::url() const static JS::ThrowCompletionOr<LocationObject*> typed_this_value(JS::GlobalObject& global_object) { auto& vm = global_object.vm(); - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); if (!this_value.is_object() || !is<LocationObject>(this_value.as_object())) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "Location"); return static_cast<LocationObject*>(&this_value.as_object()); diff --git a/Userland/Libraries/LibWeb/Bindings/Replaceable.h b/Userland/Libraries/LibWeb/Bindings/Replaceable.h index a669e1d183..6ed3883935 100644 --- a/Userland/Libraries/LibWeb/Bindings/Replaceable.h +++ b/Userland/Libraries/LibWeb/Bindings/Replaceable.h @@ -7,7 +7,7 @@ #pragma once #define REPLACEABLE_PROPERTY_SETTER(ObjectType, property) \ - auto this_value = vm.this_value(global_object); \ + auto this_value = vm.this_value(); \ if (!this_value.is_object() || !is<ObjectType>(this_value.as_object())) \ return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, #ObjectType); \ TRY(this_value.as_object().internal_define_own_property( \ diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp index 9760131aa8..a528a91dc8 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -180,7 +180,7 @@ static JS::ThrowCompletionOr<HTML::Window*> impl_from(JS::VM& vm, JS::GlobalObje // this_value to a specific object type in the bindings. But since window is // the global object we make an exception here. // This allows calls like `setTimeout(f, 10)` to work. - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); if (this_value.is_nullish()) this_value = &global_object; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp index 17cb7ef488..961ff4314d 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp @@ -18,7 +18,7 @@ void WebAssemblyInstancePrototype::initialize(JS::Realm& realm) JS_DEFINE_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter) { - auto this_value = vm.this_value(global_object); + auto this_value = vm.this_value(); auto* this_object = TRY(this_value.to_object(global_object)); if (!is<WebAssemblyInstanceObject>(this_object)) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Instance"); diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp index 840752a84a..c3ec451433 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp @@ -20,7 +20,7 @@ void WebAssemblyMemoryPrototype::initialize(JS::Realm& realm) JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow) { auto page_count = TRY(vm.argument(0).to_u32(global_object)); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); if (!is<WebAssemblyMemoryObject>(this_object)) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory"); auto* memory_object = static_cast<WebAssemblyMemoryObject*>(this_object); @@ -40,7 +40,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::buffer_getter) { auto& realm = *global_object.associated_realm(); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); if (!is<WebAssemblyMemoryObject>(this_object)) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Memory"); auto* memory_object = static_cast<WebAssemblyMemoryObject*>(this_object); diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp index ff915e5207..d51b9cd46b 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp @@ -23,7 +23,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow) { auto delta = TRY(vm.argument(0).to_u32(global_object)); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); if (!is<WebAssemblyTableObject>(this_object)) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table"); auto* table_object = static_cast<WebAssemblyTableObject*>(this_object); @@ -53,7 +53,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::get) { auto index = TRY(vm.argument(0).to_u32(global_object)); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); if (!is<WebAssemblyTableObject>(this_object)) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table"); auto* table_object = static_cast<WebAssemblyTableObject*>(this_object); @@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set) { auto index = TRY(vm.argument(0).to_u32(global_object)); - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); if (!is<WebAssemblyTableObject>(this_object)) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table"); auto* table_object = static_cast<WebAssemblyTableObject*>(this_object); @@ -105,7 +105,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set) JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::length_getter) { - auto* this_object = TRY(vm.this_value(global_object).to_object(global_object)); + auto* this_object = TRY(vm.this_value().to_object(global_object)); if (!is<WebAssemblyTableObject>(this_object)) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Table"); auto* table_object = static_cast<WebAssemblyTableObject*>(this_object); |