1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:25:08 +00:00

JSSpecCompiler: Store arguments in declaration instead of definition

And create a struct encapsulating argument name in the preparation for
argument types and optional arguments.
This commit is contained in:
Dan Klishch 2024-01-15 23:02:35 -05:00 committed by Andrew Kaster
parent 0806ccaeec
commit 483e195e48
8 changed files with 57 additions and 40 deletions

View file

@ -40,15 +40,15 @@ FunctionDeclarationRef TranslationUnit::find_declaration_by_name(StringView name
return it->value;
}
FunctionDeclaration::FunctionDeclaration(StringView name)
FunctionDeclaration::FunctionDeclaration(StringView name, Vector<FunctionArgument>&& arguments)
: m_name(name)
, m_arguments(arguments)
{
}
FunctionDefinition::FunctionDefinition(StringView name, Tree ast, Vector<StringView>&& argument_names)
: FunctionDeclaration(name)
FunctionDefinition::FunctionDefinition(StringView name, Tree ast, Vector<FunctionArgument>&& arguments)
: FunctionDeclaration(name, move(arguments))
, m_ast(move(ast))
, m_argument_names(move(argument_names))
, m_named_return_value(make_ref_counted<NamedVariableDeclaration>("$return"sv))
{
}