diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-10-08 19:45:19 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-10-08 19:45:19 +0200 |
| commit | 7d07bef760a8807fe49fbe5c90799a1822f95973 (patch) | |
| tree | 8b8d8ed0003dc61c4bd7313df86f6cbaea3d4b82 /boot/symbol.cc | |
| parent | d392f0c54a7748b816ab327758ae835f73cd1c0a (diff) | |
| download | elna-7d07bef760a8807fe49fbe5c90799a1822f95973.tar.gz | |
Make modules re-exportable
Diffstat (limited to 'boot/symbol.cc')
| -rw-r--r-- | boot/symbol.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/boot/symbol.cc b/boot/symbol.cc index 375cbfd..2805839 100644 --- a/boot/symbol.cc +++ b/boot/symbol.cc @@ -522,7 +522,8 @@ namespace elna::boot return this->unresolved.insert({ symbol_name, std::move(forward_declaration) }).second; } - std::vector<import_collision> symbol_bag::add_import(const std::shared_ptr<symbol_table>& symbols) + std::vector<import_collision> symbol_bag::add_import(const std::shared_ptr<symbol_table>& symbols, + const bool reexport) { std::vector<import_collision> collisions; @@ -538,7 +539,10 @@ namespace elna::boot } } this->imports.push_back(symbols); - + if (reexport) + { + this->reexports.push_back(symbols); + } return collisions; } @@ -553,6 +557,15 @@ namespace elna::boot if (!m_exported) { m_exported = std::make_shared<symbol_table>(symbols->scope()); + // The same symbol can reach a module along several re-export + // paths; it is the same info then, so entering it twice is a no-op. + for (const auto& reexported : this->reexports) + { + for (const auto& [name, info] : *reexported) + { + m_exported->enter(name, info); + } + } for (const auto& [name, info] : *symbols) { if (info->exported) |
