summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/AST.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/AST.cpp')
-rw-r--r--Libraries/LibJS/AST.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index 23baf14d23..407ecd8caa 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -101,16 +101,20 @@ Value CallExpression::execute(Interpreter& interpreter) const
auto& function = static_cast<Function&>(callee.as_object());
- auto& call_frame = interpreter.push_call_frame();
+ Vector<Value> arguments;
+ arguments.ensure_capacity(m_arguments.size());
for (size_t i = 0; i < m_arguments.size(); ++i) {
auto value = m_arguments[i].execute(interpreter);
if (interpreter.exception())
return {};
- call_frame.arguments.append(value);
+ arguments.append(value);
if (interpreter.exception())
return {};
}
+ auto& call_frame = interpreter.push_call_frame();
+ call_frame.arguments = move(arguments);
+
Object* new_object = nullptr;
Value result;
if (is_new_expression()) {