mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 02:40:49 +00:00
LibJS: Stop creating a redundant lexical scope on function call
We were scoping the arguments twice, first in execute_function_body(), and then again in enter_scope().
This commit is contained in:
@@ -127,7 +127,6 @@ Value ScriptFunction::execute_function_body()
|
||||
VM::InterpreterExecutionScope scope(*interpreter);
|
||||
|
||||
auto& call_frame_args = vm.call_frame().arguments;
|
||||
ArgumentVector arguments;
|
||||
for (size_t i = 0; i < m_parameters.size(); ++i) {
|
||||
auto parameter = m_parameters[i];
|
||||
Value argument_value;
|
||||
@@ -145,11 +144,10 @@ Value ScriptFunction::execute_function_body()
|
||||
} else {
|
||||
argument_value = js_undefined();
|
||||
}
|
||||
arguments.append({ parameter.name, argument_value });
|
||||
vm.current_scope()->put_to_scope(parameter.name, { argument_value, DeclarationKind::Var });
|
||||
}
|
||||
|
||||
return interpreter->execute_statement(global_object(), m_body, move(arguments), ScopeType::Function);
|
||||
return interpreter->execute_statement(global_object(), m_body, {}, ScopeType::Function);
|
||||
}
|
||||
|
||||
Value ScriptFunction::call()
|
||||
|
||||
Reference in New Issue
Block a user