mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25: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:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user