mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +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:
parent
f3117d46dc
commit
999da617c5
36 changed files with 208 additions and 206 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue