mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibJS: Convert PromiseResolvingFunction::create() to NonnullGCPtr
This commit is contained in:
parent
d3cb7cd584
commit
6e386acb11
Notes:
sideshowbarker
2024-07-18 04:38:32 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/6e386acb11 Pull-request: https://github.com/SerenityOS/serenity/pull/16479 Reviewed-by: https://github.com/davidot ✅
3 changed files with 5 additions and 5 deletions
|
@ -71,7 +71,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
|
|||
// 6. Set resolve.[[AlreadyResolved]] to alreadyResolved.
|
||||
|
||||
// 27.2.1.3.2 Promise Resolve Functions, https://tc39.es/ecma262/#sec-promise-resolve-functions
|
||||
auto* resolve_function = PromiseResolvingFunction::create(realm, *this, *already_resolved, [](auto& vm, auto& promise, auto& already_resolved) {
|
||||
auto resolve_function = PromiseResolvingFunction::create(realm, *this, *already_resolved, [](auto& vm, auto& promise, auto& already_resolved) {
|
||||
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / PromiseResolvingFunction]: Resolve function was called", &promise);
|
||||
|
||||
auto& realm = *vm.current_realm();
|
||||
|
@ -166,7 +166,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
|
|||
// 11. Set reject.[[AlreadyResolved]] to alreadyResolved.
|
||||
|
||||
// 27.2.1.3.1 Promise Reject Functions, https://tc39.es/ecma262/#sec-promise-reject-functions
|
||||
auto* reject_function = PromiseResolvingFunction::create(realm, *this, *already_resolved, [](auto& vm, auto& promise, auto& already_resolved) {
|
||||
auto reject_function = PromiseResolvingFunction::create(realm, *this, *already_resolved, [](auto& vm, auto& promise, auto& already_resolved) {
|
||||
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / PromiseResolvingFunction]: Reject function was called", &promise);
|
||||
|
||||
auto reason = vm.argument(0);
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
PromiseResolvingFunction* PromiseResolvingFunction::create(Realm& realm, Promise& promise, AlreadyResolved& already_resolved, FunctionType function)
|
||||
NonnullGCPtr<PromiseResolvingFunction> PromiseResolvingFunction::create(Realm& realm, Promise& promise, AlreadyResolved& already_resolved, FunctionType function)
|
||||
{
|
||||
return realm.heap().allocate<PromiseResolvingFunction>(realm, promise, already_resolved, move(function), *realm.intrinsics().function_prototype());
|
||||
return *realm.heap().allocate<PromiseResolvingFunction>(realm, promise, already_resolved, move(function), *realm.intrinsics().function_prototype());
|
||||
}
|
||||
|
||||
PromiseResolvingFunction::PromiseResolvingFunction(Promise& promise, AlreadyResolved& already_resolved, FunctionType native_function, Object& prototype)
|
||||
|
|
|
@ -28,7 +28,7 @@ class PromiseResolvingFunction final : public NativeFunction {
|
|||
public:
|
||||
using FunctionType = Function<ThrowCompletionOr<Value>(VM&, Promise&, AlreadyResolved&)>;
|
||||
|
||||
static PromiseResolvingFunction* create(Realm&, Promise&, AlreadyResolved&, FunctionType);
|
||||
static NonnullGCPtr<PromiseResolvingFunction> create(Realm&, Promise&, AlreadyResolved&, FunctionType);
|
||||
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~PromiseResolvingFunction() override = default;
|
||||
|
|
Loading…
Reference in a new issue