mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibJS: Convert NumberObject::create() to NonnullGCPtr
This commit is contained in:
parent
b42e293ddd
commit
f990095728
Notes:
sideshowbarker
2024-07-17 07:11:12 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/f990095728 Pull-request: https://github.com/SerenityOS/serenity/pull/16479 Reviewed-by: https://github.com/davidot ✅
3 changed files with 4 additions and 4 deletions
|
@ -9,9 +9,9 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
NumberObject* NumberObject::create(Realm& realm, double value)
|
||||
NonnullGCPtr<NumberObject> NumberObject::create(Realm& realm, double value)
|
||||
{
|
||||
return realm.heap().allocate<NumberObject>(realm, value, *realm.intrinsics().number_prototype());
|
||||
return *realm.heap().allocate<NumberObject>(realm, value, *realm.intrinsics().number_prototype());
|
||||
}
|
||||
|
||||
NumberObject::NumberObject(double value, Object& prototype)
|
||||
|
|
|
@ -14,7 +14,7 @@ class NumberObject : public Object {
|
|||
JS_OBJECT(NumberObject, Object);
|
||||
|
||||
public:
|
||||
static NumberObject* create(Realm&, double);
|
||||
static NonnullGCPtr<NumberObject> create(Realm&, double);
|
||||
|
||||
virtual ~NumberObject() override = default;
|
||||
|
||||
|
|
|
@ -523,7 +523,7 @@ ThrowCompletionOr<Object*> Value::to_object(VM& vm) const
|
|||
// Number
|
||||
if (is_number()) {
|
||||
// Return a new Number object whose [[NumberData]] internal slot is set to argument. See 21.1 for a description of Number objects.
|
||||
return NumberObject::create(realm, as_double());
|
||||
return NumberObject::create(realm, as_double()).ptr();
|
||||
}
|
||||
|
||||
switch (m_value.tag) {
|
||||
|
|
Loading…
Reference in a new issue