diff options
author | Linus Groh <mail@linusgroh.de> | 2022-08-21 14:00:56 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-23 13:58:30 +0100 |
commit | a022e548b808df91c471cb55f0245e15957e89c4 (patch) | |
tree | d6a7d452eae1d06e537a2fd77348ecaab278614f /Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp | |
parent | f6c4a0f5d00a6a03a5165f1618516acb320f13a4 (diff) | |
download | serenity-a022e548b808df91c471cb55f0245e15957e89c4.zip |
LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]
This is where the fun begins. :^)
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index d956aa90d5..9a094a48af 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -27,7 +27,7 @@ static ThrowCompletionOr<Value> get_promise_resolve(GlobalObject& global_object, auto& vm = global_object.vm(); // 1. Let promiseResolve be ? Get(promiseConstructor, "resolve"). - auto promise_resolve = TRY(constructor.get(global_object, vm.names.resolve)); + auto promise_resolve = TRY(constructor.get(vm, vm.names.resolve)); // 2. If IsCallable(promiseResolve) is false, throw a TypeError exception. if (!promise_resolve.is_function()) @@ -146,7 +146,7 @@ static ThrowCompletionOr<Value> perform_promise_all(GlobalObject& global_object, on_fulfilled->define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable); // s. Perform ? Invoke(nextPromise, "then", « onFulfilled, resultCapability.[[Reject]] »). - return next_promise.invoke(global_object, vm.names.then, on_fulfilled, result_capability.reject); + return next_promise.invoke(vm, vm.names.then, on_fulfilled, result_capability.reject); }); } @@ -190,7 +190,7 @@ static ThrowCompletionOr<Value> perform_promise_all_settled(GlobalObject& global on_rejected->define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable); // ab. Perform ? Invoke(nextPromise, "then", « onFulfilled, onRejected »). - return next_promise.invoke(global_object, vm.names.then, on_fulfilled, on_rejected); + return next_promise.invoke(vm, vm.names.then, on_fulfilled, on_rejected); }); } @@ -226,7 +226,7 @@ static ThrowCompletionOr<Value> perform_promise_any(GlobalObject& global_object, on_rejected->define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable); // s. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], onRejected »). - return next_promise.invoke(global_object, vm.names.then, result_capability.resolve, on_rejected); + return next_promise.invoke(vm, vm.names.then, result_capability.resolve, on_rejected); }); } @@ -243,7 +243,7 @@ static ThrowCompletionOr<Value> perform_promise_race(GlobalObject& global_object }, [&](PromiseValueList&, RemainingElements&, Value next_promise, size_t) { // i. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], resultCapability.[[Reject]] »). - return next_promise.invoke(global_object, vm.names.then, result_capability.resolve, result_capability.reject); + return next_promise.invoke(vm, vm.names.then, result_capability.resolve, result_capability.reject); }); } @@ -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().to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(vm)); // 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().to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(vm)); // 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().to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(vm)); // 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().to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(vm)); // 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().to_object(global_object)); + auto* constructor = TRY(vm.this_value().to_object(vm)); // 2. Let promiseCapability be ? NewPromiseCapability(C). auto promise_capability = TRY(new_promise_capability(global_object, constructor)); |