diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-13 20:49:50 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-14 09:59:45 +0000 |
commit | 81d5bbcb04e9c20d052dc06b8051c828a7250c63 (patch) | |
tree | f5442c257f1c346c80e79b9fefdeab001f49893f /Userland | |
parent | 46acce51423f328c214dc0781fa19bca1911b5f0 (diff) | |
download | serenity-81d5bbcb04e9c20d052dc06b8051c828a7250c63.zip |
LibJS: Convert Intl::DateTimeFormatFunction::create() to NonnullGCPtr
Diffstat (limited to 'Userland')
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp index 9408a7904d..3b8be4d42a 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp @@ -14,9 +14,9 @@ namespace JS::Intl { // 11.5.5 DateTime Format Functions, https://tc39.es/ecma402/#sec-datetime-format-functions -DateTimeFormatFunction* DateTimeFormatFunction::create(Realm& realm, DateTimeFormat& date_time_format) +NonnullGCPtr<DateTimeFormatFunction> DateTimeFormatFunction::create(Realm& realm, DateTimeFormat& date_time_format) { - return realm.heap().allocate<DateTimeFormatFunction>(realm, date_time_format, *realm.intrinsics().function_prototype()); + return *realm.heap().allocate<DateTimeFormatFunction>(realm, date_time_format, *realm.intrinsics().function_prototype()); } DateTimeFormatFunction::DateTimeFormatFunction(DateTimeFormat& date_time_format, Object& prototype) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h index d11669b8c7..8634629ba3 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h @@ -16,7 +16,7 @@ class DateTimeFormatFunction final : public NativeFunction { JS_OBJECT(DateTimeFormatFunction, NativeFunction); public: - static DateTimeFormatFunction* create(Realm&, DateTimeFormat&); + static NonnullGCPtr<DateTimeFormatFunction> create(Realm&, DateTimeFormat&); virtual ~DateTimeFormatFunction() override = default; virtual void initialize(Realm&) override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp index 2e6b99c5da..a18f751782 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp @@ -52,7 +52,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateTimeFormatPrototype::format) if (!date_time_format->bound_format()) { // a. Let F be a new built-in function object as defined in DateTime Format Functions (11.1.6). // b. Set F.[[DateTimeFormat]] to dtf. - auto* bound_format = DateTimeFormatFunction::create(realm, *date_time_format); + auto bound_format = DateTimeFormatFunction::create(realm, *date_time_format); // c. Set dtf.[[BoundFormat]] to F. date_time_format->set_bound_format(bound_format); |