1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

LibJS: Remove GlobalObject from VM::this_value()

This is a continuation of the previous six commits.

The global object is only needed to return it if the execution context
stack is empty, but that doesn't seem like a useful thing to allow in
the first place - if you're not currently executing JS, and the
execution context stack is empty, there is no this value to retrieve.
This commit is contained in:
Linus Groh 2022-08-20 09:48:43 +01:00
parent f3117d46dc
commit 999da617c5
36 changed files with 208 additions and 206 deletions

View file

@ -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();
}
}