mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +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:
parent
eb810d14c3
commit
fc9e43728b
Notes:
sideshowbarker
2024-07-19 00:59:11 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/fc9e43728bc
1 changed files with 1 additions and 3 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue