From 46acce51423f328c214dc0781fa19bca1911b5f0 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 13 Dec 2022 20:49:50 +0000 Subject: LibJS: Convert Intl::CollatorCompareFunction::create() to NonnullGCPtr --- Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h | 2 +- Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp index ce9d77b282..7da460de03 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp @@ -11,9 +11,9 @@ namespace JS::Intl { -CollatorCompareFunction* CollatorCompareFunction::create(Realm& realm, Collator& collator) +NonnullGCPtr CollatorCompareFunction::create(Realm& realm, Collator& collator) { - return realm.heap().allocate(realm, realm, collator); + return *realm.heap().allocate(realm, realm, collator); } CollatorCompareFunction::CollatorCompareFunction(Realm& realm, Collator& collator) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h index 3bdbc5dd6b..4f56c547c6 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h @@ -14,7 +14,7 @@ class CollatorCompareFunction : public NativeFunction { JS_OBJECT(CollatorCompareFunction, NativeFunction); public: - static CollatorCompareFunction* create(Realm&, Collator&); + static NonnullGCPtr create(Realm&, Collator&); virtual void initialize(Realm&) override; virtual ~CollatorCompareFunction() override = default; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp index b098839f2a..c46df80645 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp @@ -44,7 +44,7 @@ JS_DEFINE_NATIVE_FUNCTION(CollatorPrototype::compare_getter) if (!collator->bound_compare()) { // a. Let F be a new built-in function object as defined in 10.3.3.1. // b. Set F.[[Collator]] to collator. - auto* function = CollatorCompareFunction::create(realm, *collator); + auto function = CollatorCompareFunction::create(realm, *collator); // c. Set collator.[[BoundCompare]] to F. collator->set_bound_compare(function); -- cgit v1.2.3