mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibJS: Convert Intl::NumberFormatFunction::create() to NonnullGCPtr
This commit is contained in:
parent
b2034c59dc
commit
658bd2f342
Notes:
sideshowbarker
2024-07-17 05:58:46 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/658bd2f342 Pull-request: https://github.com/SerenityOS/serenity/pull/16479 Reviewed-by: https://github.com/davidot ✅
3 changed files with 4 additions and 4 deletions
|
@ -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> NumberFormatFunction::create(Realm& realm, NumberFormat& number_format)
|
||||
{
|
||||
return realm.heap().allocate<NumberFormatFunction>(realm, number_format, *realm.intrinsics().function_prototype());
|
||||
return *realm.heap().allocate<NumberFormatFunction>(realm, number_format, *realm.intrinsics().function_prototype());
|
||||
}
|
||||
|
||||
NumberFormatFunction::NumberFormatFunction(NumberFormat& number_format, Object& prototype)
|
||||
|
|
|
@ -16,7 +16,7 @@ class NumberFormatFunction final : public NativeFunction {
|
|||
JS_OBJECT(NumberFormatFunction, NativeFunction);
|
||||
|
||||
public:
|
||||
static NumberFormatFunction* create(Realm&, NumberFormat&);
|
||||
static NonnullGCPtr<NumberFormatFunction> create(Realm&, NumberFormat&);
|
||||
|
||||
virtual ~NumberFormatFunction() override = default;
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue