LibJS: Convert NumberObject::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent b42e293ddd
commit f990095728
Notes: sideshowbarker 2024-07-17 07:11:12 +09:00
3 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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;

View file

@ -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) {