1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:18:14 +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:
Andreas Kling 2020-12-08 18:21:55 +01:00
parent 38268f1c53
commit 48d2545572
6 changed files with 10 additions and 23 deletions

View file

@ -93,7 +93,7 @@ Value ScopeNode::execute(Interpreter& interpreter, GlobalObject& global_object)
Value Program::execute(Interpreter& interpreter, GlobalObject& global_object) const
{
return interpreter.execute_statement(global_object, *this, {}, ScopeType::Block);
return interpreter.execute_statement(global_object, *this, ScopeType::Block);
}
Value FunctionDeclaration::execute(Interpreter&, GlobalObject&) const
@ -340,7 +340,7 @@ Value ForStatement::execute(Interpreter& interpreter, GlobalObject& global_objec
NonnullRefPtrVector<VariableDeclaration> decls;
decls.append(*static_cast<const VariableDeclaration*>(m_init.ptr()));
wrapper->add_variables(decls);
interpreter.enter_scope(*wrapper, {}, ScopeType::Block, global_object);
interpreter.enter_scope(*wrapper, ScopeType::Block, global_object);
}
auto wrapper_cleanup = ScopeGuard([&] {
@ -416,7 +416,7 @@ static FlyString variable_from_for_declaration(Interpreter& interpreter, GlobalO
ASSERT(!variable_declaration->declarations().is_empty());
if (variable_declaration->declaration_kind() != DeclarationKind::Var) {
wrapper = create_ast_node<BlockStatement>();
interpreter.enter_scope(*wrapper, {}, ScopeType::Block, global_object);
interpreter.enter_scope(*wrapper, ScopeType::Block, global_object);
}
variable_declaration->execute(interpreter, global_object);
variable_name = variable_declaration->declarations().first().id().string();
@ -1897,7 +1897,7 @@ void ThrowStatement::dump(int indent) const
Value TryStatement::execute(Interpreter& interpreter, GlobalObject& global_object) const
{
interpreter.execute_statement(global_object, m_block, {}, ScopeType::Try);
interpreter.execute_statement(global_object, m_block, ScopeType::Try);
if (auto* exception = interpreter.exception()) {
if (m_handler) {
interpreter.vm().clear_exception();