mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibJS+LibWeb: Pass prototype to Object constructor
Everyone who constructs an Object must now pass a prototype object when applicable. There's still a fair amount of code that passes something fetched from the Interpreter, but this brings us closer to being able to detach prototypes from Interpreter eventually.
This commit is contained in:
parent
f6d57c82f6
commit
bc1ece7f37
30 changed files with 60 additions and 28 deletions
|
@ -124,7 +124,7 @@ Value CallExpression::execute(Interpreter& interpreter) const
|
|||
Object* new_object = nullptr;
|
||||
Value result;
|
||||
if (is_new_expression()) {
|
||||
new_object = interpreter.heap().allocate<Object>();
|
||||
new_object = Object::create_empty(interpreter, interpreter.global_object());
|
||||
auto prototype = function.get("prototype");
|
||||
if (prototype.has_value() && prototype.value().is_object())
|
||||
new_object->set_prototype(&prototype.value().as_object());
|
||||
|
@ -901,7 +901,7 @@ void ExpressionStatement::dump(int indent) const
|
|||
|
||||
Value ObjectExpression::execute(Interpreter& interpreter) const
|
||||
{
|
||||
auto object = interpreter.heap().allocate<Object>();
|
||||
auto* object = Object::create_empty(interpreter, interpreter.global_object());
|
||||
for (auto it : m_properties) {
|
||||
auto value = it.value->execute(interpreter);
|
||||
if (interpreter.exception())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue