1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibJS: Replace GlobalObject with VM in remaining AOs [Part 19/19]

This commit is contained in:
Linus Groh 2022-08-21 20:38:35 +01:00
parent 25849f8a6d
commit 56b2ae5ac0
46 changed files with 173 additions and 207 deletions

View file

@ -29,16 +29,15 @@ Completion::Completion(ThrowCompletionOr<Value> const& throw_completion_or_value
}
// 6.2.3.1 Await, https://tc39.es/ecma262/#await
ThrowCompletionOr<Value> await(GlobalObject& global_object, Value value)
ThrowCompletionOr<Value> await(VM& vm, Value value)
{
auto& vm = global_object.vm();
auto& realm = *global_object.associated_realm();
auto& realm = *vm.current_realm();
// 1. Let asyncContext be the running execution context.
// NOTE: This is not needed, as we don't suspend anything.
// 2. Let promise be ? PromiseResolve(%Promise%, value).
auto* promise_object = TRY(promise_resolve(vm, *global_object.promise_constructor(), value));
auto* promise_object = TRY(promise_resolve(vm, *realm.global_object().promise_constructor(), value));
Optional<bool> success;
Value result;