diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-08-29 10:03:11 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-08-29 10:03:11 +0200 |
| commit | 08d9c4292ebba3e320c1dbaca4fa06c83f6fc7fb (patch) | |
| tree | 6ab464ecb3478eb958c75e696e90a9d04f9a1b80 /boot/dependency.cc | |
| parent | 8e655a0786aec5e0215e09f2a9629c6f32e34793 (diff) | |
| download | elna-08d9c4292ebba3e320c1dbaca4fa06c83f6fc7fb.tar.gz | |
Fix procedure order resolution
Diffstat (limited to 'boot/dependency.cc')
| -rw-r--r-- | boot/dependency.cc | 21 |
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); |
