mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibJS: Convert Intl::DateTimeFormatFunction::create() to NonnullGCPtr
This commit is contained in:
parent
46acce5142
commit
81d5bbcb04
Notes:
sideshowbarker
2024-07-17 22:01:16 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/81d5bbcb04 Pull-request: https://github.com/SerenityOS/serenity/pull/16479 Reviewed-by: https://github.com/davidot ✅
3 changed files with 4 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue