Declare an additional name analysis visitor

This commit is contained in:
2025-06-20 22:33:37 +02:00
parent 6da2a70329
commit 67a8d2c057
4 changed files with 312 additions and 74 deletions

View File

@ -764,7 +764,7 @@ namespace elna::gcc
this->current_expression = NULL_TREE;
if (!result)
{
error_at(declaration_location, "variable '%s' already declared in this scope",
error_at(declaration_location, "Variable '%s' already declared in this scope",
declaration->identifier.identifier.c_str());
}
else if (lang_hooks.decls.global_bindings_p())

View File

@ -84,16 +84,26 @@ static void elna_parse_file(const char *filename)
{
for (const std::unique_ptr<elna::boot::program>& module_tree : outcome.modules)
{
elna::boot::declaration_visitor declaration_visitor(filename, info_table);
elna::boot::declaration_visitor declaration_visitor(filename);
declaration_visitor.visit(module_tree.get());
if (declaration_visitor.errors().empty())
{
elna::gcc::do_semantic_analysis(info_table, symbol_table);
elna::boot::name_analysis_visitor name_analysis_visitor(filename, info_table,
std::move(declaration_visitor.unresolved));
name_analysis_visitor.visit(module_tree.get());
elna::gcc::generic_visitor generic_visitor{ symbol_table, info_table };
generic_visitor.visit(module_tree.get());
if (name_analysis_visitor.errors().empty())
{
elna::gcc::do_semantic_analysis(info_table, symbol_table);
elna::gcc::generic_visitor generic_visitor{ symbol_table, info_table };
generic_visitor.visit(module_tree.get());
}
else
{
elna::gcc::report_errors(name_analysis_visitor.errors());
}
}
else
{