From 658bd2f342804c670d2ef7fd0894c858a95a072f Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 13 Dec 2022 20:49:50 +0000 Subject: [PATCH] LibJS: Convert Intl::NumberFormatFunction::create() to NonnullGCPtr --- .../Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h | 2 +- .../Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp index f8c2e3419b9..ea4377ec3bb 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp @@ -12,9 +12,9 @@ namespace JS::Intl { // 15.5.2 Number Format Functions, https://tc39.es/ecma402/#sec-number-format-functions // 1.1.4 Number Format Functions, https://tc39.es/proposal-intl-numberformat-v3/out/numberformat/proposed.html#sec-number-format-functions -NumberFormatFunction* NumberFormatFunction::create(Realm& realm, NumberFormat& number_format) +NonnullGCPtr NumberFormatFunction::create(Realm& realm, NumberFormat& number_format) { - return realm.heap().allocate(realm, number_format, *realm.intrinsics().function_prototype()); + return *realm.heap().allocate(realm, number_format, *realm.intrinsics().function_prototype()); } NumberFormatFunction::NumberFormatFunction(NumberFormat& number_format, Object& prototype) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h index 7ea30be9fc5..1cba9b402c1 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h @@ -16,7 +16,7 @@ class NumberFormatFunction final : public NativeFunction { JS_OBJECT(NumberFormatFunction, NativeFunction); public: - static NumberFormatFunction* create(Realm&, NumberFormat&); + static NonnullGCPtr create(Realm&, NumberFormat&); virtual ~NumberFormatFunction() override = default; virtual void initialize(Realm&) override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp index b6e4187491d..092a948d83e 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp @@ -52,7 +52,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberFormatPrototype::format) if (!number_format->bound_format()) { // a. Let F be a new built-in function object as defined in Number Format Functions (15.1.4). // b. Set F.[[NumberFormat]] to nf. - auto* bound_format = NumberFormatFunction::create(realm, *number_format); + auto bound_format = NumberFormatFunction::create(realm, *number_format); // c. Set nf.[[BoundFormat]] to F. number_format->set_bound_format(bound_format);