mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +00:00
LibJS: Pass prototype to NumberObject constructor
This commit is contained in:
parent
2d7b495244
commit
cf702a13b9
5 changed files with 15 additions and 7 deletions
|
@ -26,16 +26,23 @@
|
|||
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/NumberObject.h>
|
||||
#include <LibJS/Runtime/NumberPrototype.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
NumberObject::NumberObject(double value)
|
||||
NumberObject* NumberObject::create(GlobalObject& global_object, double value)
|
||||
{
|
||||
auto& interpreter = global_object.interpreter();
|
||||
return interpreter.heap().allocate<NumberObject>(value, *interpreter.number_prototype());
|
||||
}
|
||||
|
||||
NumberObject::NumberObject(double value, Object& prototype)
|
||||
: m_value(value)
|
||||
{
|
||||
set_prototype(interpreter().number_prototype());
|
||||
set_prototype(&prototype);
|
||||
}
|
||||
|
||||
NumberObject::~NumberObject()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue