mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibJS: Evaluate CallExpression arguments before pushing a CallFrame
This commit is contained in:
parent
8f08ec5038
commit
bb15b37228
Notes:
sideshowbarker
2024-07-19 08:00:14 +09:00
Author: https://github.com/jack-karamanian
Commit: bb15b37228
Pull-request: https://github.com/SerenityOS/serenity/pull/1573
2 changed files with 23 additions and 2 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue