1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 19:05: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

@ -249,12 +249,12 @@ void SpecParsingStep::run(TranslationUnitRef translation_unit)
auto spec_function = SpecFunction::create(&m_document->root()).release_value_but_fixme_should_propagate_errors();
Vector<StringView> argument_names;
Vector<FunctionArgument> arguments;
for (auto const& argument : spec_function.m_arguments)
argument_names.append(argument.name);
arguments.append({ argument.name });
translation_unit->adopt_function(
make_ref_counted<FunctionDefinition>(spec_function.m_name, spec_function.m_algorithm.m_tree, move(argument_names)));
make_ref_counted<FunctionDefinition>(spec_function.m_name, spec_function.m_algorithm.m_tree, move(arguments)));
}
}