mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 01:05:08 +00:00
LibJS: Get rid of Argument and ArgumentVector
This was used for a feature where you could pass a vector of arguments to enter_scope(). Since that way of passing arguments was not GC-aware (as vectors use C++ heap storage), let's avoid using it and make sure everything that needs to stay alive is either on the stack or in traced storage instead.
This commit is contained in:
parent
38268f1c53
commit
48d2545572
6 changed files with 10 additions and 23 deletions
|
@ -90,7 +90,7 @@ const GlobalObject& Interpreter::global_object() const
|
|||
return static_cast<const GlobalObject&>(*m_global_object.cell());
|
||||
}
|
||||
|
||||
void Interpreter::enter_scope(const ScopeNode& scope_node, ArgumentVector arguments, ScopeType scope_type, GlobalObject& global_object)
|
||||
void Interpreter::enter_scope(const ScopeNode& scope_node, ScopeType scope_type, GlobalObject& global_object)
|
||||
{
|
||||
for (auto& declaration : scope_node.functions()) {
|
||||
auto* function = ScriptFunction::create(global_object, declaration.name(), declaration.body(), declaration.parameters(), declaration.function_length(), current_scope(), declaration.is_strict_mode());
|
||||
|
@ -117,10 +117,6 @@ void Interpreter::enter_scope(const ScopeNode& scope_node, ArgumentVector argume
|
|||
}
|
||||
}
|
||||
|
||||
for (auto& argument : arguments) {
|
||||
scope_variables_with_declaration_kind.set(argument.name, { argument.value, DeclarationKind::Var });
|
||||
}
|
||||
|
||||
bool pushed_lexical_environment = false;
|
||||
|
||||
if (!scope_variables_with_declaration_kind.is_empty()) {
|
||||
|
@ -152,13 +148,13 @@ void Interpreter::push_scope(ScopeFrame frame)
|
|||
m_scope_stack.append(move(frame));
|
||||
}
|
||||
|
||||
Value Interpreter::execute_statement(GlobalObject& global_object, const Statement& statement, ArgumentVector arguments, ScopeType scope_type)
|
||||
Value Interpreter::execute_statement(GlobalObject& global_object, const Statement& statement, ScopeType scope_type)
|
||||
{
|
||||
if (!statement.is_scope_node())
|
||||
return statement.execute(*this, global_object);
|
||||
|
||||
auto& block = static_cast<const ScopeNode&>(statement);
|
||||
enter_scope(block, move(arguments), scope_type, global_object);
|
||||
enter_scope(block, scope_type, global_object);
|
||||
|
||||
if (block.children().is_empty())
|
||||
vm().set_last_value({}, js_undefined());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue