diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-09-19 23:52:00 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-09-19 23:52:00 +0200 |
| commit | 74e75e41fe12f19e5365a3152ffafa1a29376240 (patch) | |
| tree | 5cee18580124db1bd9c8bc01e8b58ed16b0cf159 /boot/dependency.cc | |
| parent | b3cf1d087283bd85e0d9906dfdc320bd9eb4021a (diff) | |
| download | elna-74e75e41fe12f19e5365a3152ffafa1a29376240.tar.gz | |
Diffstat (limited to 'boot/dependency.cc')
| -rw-r--r-- | boot/dependency.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/boot/dependency.cc b/boot/dependency.cc index 1eb5953..5053a36 100644 --- a/boot/dependency.cc +++ b/boot/dependency.cc @@ -72,7 +72,7 @@ namespace elna::boot } analysis_result analyze_semantics(std::unique_ptr<unit>& tree, - const std::vector<std::shared_ptr<symbol_table>>& imports, + const std::vector<module_import>& imports, const std::shared_ptr<symbol_table>& globals, const target_info& target, const std::filesystem::path& module_path) { @@ -90,7 +90,23 @@ namespace elna::boot } for (const auto& import : imports) { - result.value.add_import(import); + const std::vector<import_collision> collisions = result.value.add_import(import.symbols); + + for (const import_collision& collision : collisions) + { + symbol_declaration_error::redefinition original_definition{ + .original = collision.original->position, + .file = collision.original->file + }; + auto error = std::make_unique<symbol_declaration_error>(import.position, + collision.name, original_definition); + + result.errors.push_back(std::move(error)); + } + } + if (!result.errors.empty()) + { + return result; } declaration_visitor declarations(result.value, target, module_path); tree->accept(&declarations); |
