diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-18 10:27:57 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-18 11:00:55 +0200 |
commit | bc1ece7f37cf9d22af42b749a238ecc8eb07facf (patch) | |
tree | a9f33f0454f3d7cfa3611e9bd30f9ebcc6e425fe /Libraries/LibJS/AST.cpp | |
parent | f6d57c82f6dbbb5c7e18bffb43d0258956aa0d46 (diff) | |
download | serenity-bc1ece7f37cf9d22af42b749a238ecc8eb07facf.zip |
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.
Diffstat (limited to 'Libraries/LibJS/AST.cpp')
-rw-r--r-- | Libraries/LibJS/AST.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index a29229422f..93ae05e2f7 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -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()) |