mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 05:32:13 +00:00
LibJS: Prepend callee's bound arguments to the CallFrame and set the
this_value to the callee's bound |this| in CallExpression::execute()
This commit is contained in:
parent
5750edd859
commit
b3800829da
1 changed files with 4 additions and 1 deletions
|
@ -114,6 +114,9 @@ Value CallExpression::execute(Interpreter& interpreter) const
|
|||
auto& function = static_cast<Function&>(callee.as_object());
|
||||
|
||||
MarkedValueList arguments(interpreter.heap());
|
||||
for (auto bound_argument : function.bound_arguments()) {
|
||||
arguments.append(bound_argument);
|
||||
}
|
||||
for (size_t i = 0; i < m_arguments.size(); ++i) {
|
||||
auto value = m_arguments[i].execute(interpreter);
|
||||
if (interpreter.exception())
|
||||
|
@ -138,7 +141,7 @@ Value CallExpression::execute(Interpreter& interpreter) const
|
|||
call_frame.this_value = new_object;
|
||||
result = function.construct(interpreter);
|
||||
} else {
|
||||
call_frame.this_value = this_value;
|
||||
call_frame.this_value = function.bound_this().value_or(this_value);
|
||||
result = function.call(interpreter);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue