
Being really close to Object.prototype.valueOf() name wise makes this unnecessarily confusing - while it sometimes serves as the implementation of a valueOf() function, it's an abstraction which the spec doesn't have. Use the appropriate getters to retrieve specific internal slots instead, most commonly [[FooData]] from the primitive wrapper objects. For the Object class specifically, use the Value(Object*) ctor instead.
28 lines
489 B
C++
28 lines
489 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibJS/Runtime/Object.h>
|
|
|
|
namespace JS {
|
|
|
|
class NumberObject : public Object {
|
|
JS_OBJECT(NumberObject, Object);
|
|
|
|
public:
|
|
static NumberObject* create(GlobalObject&, double);
|
|
|
|
NumberObject(double, Object& prototype);
|
|
virtual ~NumberObject() override;
|
|
|
|
double number() const { return m_value; }
|
|
|
|
private:
|
|
double m_value { 0 };
|
|
};
|
|
|
|
}
|