aboutsummaryrefslogtreecommitdiff
path: root/boot/dependency.cc
diff options
context:
space:
mode:
Diffstat (limited to 'boot/dependency.cc')
-rw-r--r--boot/dependency.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/boot/dependency.cc b/boot/dependency.cc
index 7e103aa..9b52ce9 100644
--- a/boot/dependency.cc
+++ b/boot/dependency.cc
@@ -68,19 +68,30 @@ namespace elna::boot
const std::shared_ptr<symbol_table>& globals, const target_info& target,
const std::filesystem::path& module_path)
{
- declaration_visitor declarations{};
- tree->accept(&declarations);
- analysis_result result{ .value = { std::move(declarations.unresolved), globals }, .errors = {} };
+ forward_declaration_visitor forward_declarer;
- if (declarations.has_errors())
+ tree->accept(&forward_declarer);
+
+ analysis_result result{
+ .value = symbol_bag(std::move(forward_declarer.unresolved), globals),
+ .errors = std::move(forward_declarer.errors())
+ };
+ if (!result.errors.empty())
{
- std::swap(result.errors, declarations.errors());
return result;
}
for (const auto& import : imports)
{
result.value.add_import(import);
}
+ declaration_visitor declarations(result.value, target, module_path);
+ tree->accept(&declarations);
+
+ if (declarations.has_errors())
+ {
+ std::swap(result.errors, declarations.errors());
+ return result;
+ }
name_analysis_visitor name_analyser(result.value, target, module_path);
tree->accept(&name_analyser);