1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

LibJS: Use new construct AO overload where easily applicable

This commit is contained in:
Timothy Flynn 2022-01-25 15:06:40 -05:00 committed by Linus Groh
parent 67e02f6ca6
commit 59ca435172
10 changed files with 16 additions and 55 deletions

View file

@ -6,7 +6,6 @@
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/MarkedValueList.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/PromiseReaction.h>
@ -59,9 +58,7 @@ ThrowCompletionOr<PromiseCapability> new_promise_capability(GlobalObject& global
executor->define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable);
// 6. Let promise be ? Construct(C, « executor »).
MarkedValueList arguments(vm.heap());
arguments.append(executor);
auto* promise = TRY(construct(global_object, constructor.as_function(), move(arguments)));
auto* promise = TRY(construct(global_object, constructor.as_function(), executor));
// 7. If IsCallable(promiseCapability.[[Resolve]]) is false, throw a TypeError exception.
if (!promise_capability_functions.resolve.is_function())