1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

LibJS: Pass prototype to BooleanObject constructor

This commit is contained in:
Andreas Kling 2020-04-17 19:03:52 +02:00
parent 298c606200
commit 2a15323029
5 changed files with 15 additions and 8 deletions

View file

@ -26,13 +26,20 @@
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/BooleanObject.h>
#include <LibJS/Runtime/GlobalObject.h>
namespace JS {
BooleanObject::BooleanObject(bool value)
BooleanObject* BooleanObject::create(GlobalObject& global_object, bool value)
{
auto& interpreter = global_object.interpreter();
return interpreter.heap().allocate<BooleanObject>(value, *interpreter.boolean_prototype());
}
BooleanObject::BooleanObject(bool value, Object& prototype)
: m_value(value)
{
set_prototype(interpreter().boolean_prototype());
set_prototype(&prototype);
}
BooleanObject::~BooleanObject()