Allow exporting global external variables

This commit is contained in:
2025-08-24 16:54:48 +02:00
parent fd3729ba16
commit c95466622a
7 changed files with 56 additions and 52 deletions

View File

@@ -72,12 +72,13 @@ static elna::boot::dependency elna_parse_file(dependency_state& state, const cha
{
fatal_error(UNKNOWN_LOCATION, "Cannot open filename %s: %m", filename);
}
linemap_add(line_table, LC_ENTER, 0, filename, 1);
elna::gcc::linemap_guard{ filename };
elna::boot::dependency outcome = elna::boot::read_source(entry_point, filename);
if (outcome.has_errors())
{
elna::gcc::report_errors(outcome.errors());
return outcome;
}
elna::boot::symbol_bag outcome_bag = elna::boot::symbol_bag{ std::move(outcome.unresolved), state.globals };
@@ -94,15 +95,15 @@ static elna::boot::dependency elna_parse_file(dependency_state& state, const cha
}
outcome_bag.add_import(cached_import->second);
}
elna::boot::error_list semantic_errors = analyze_semantics(filename, outcome.tree, outcome_bag);
outcome.errors() = analyze_semantics(filename, outcome.tree, outcome_bag);
if (!semantic_errors.empty())
if (outcome.has_errors())
{
elna::gcc::report_errors(semantic_errors);
elna::gcc::report_errors(outcome.errors());
return outcome;
}
state.cache.insert({ filename, outcome_bag });
elna::gcc::rewrite_symbol_table(outcome_bag.leave(), state.custom);
linemap_add(line_table, LC_LEAVE, 0, NULL, 0);
return outcome;
}