mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-24 07:48:45 +00:00
.
This commit is contained in:
parent
648f78afa3
commit
496d3819d9
6 changed files with 71 additions and 16 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// for clangd
|
||||
#include "../include/link_symbols_visitor.hpp"
|
||||
#include "../include/error_handling.hpp"
|
||||
#include <optional>
|
||||
|
||||
namespace interpreter {
|
||||
|
||||
|
|
@ -20,8 +21,13 @@ const std::string& NameFromTypeSubExpression(const TypeSubExpression& type) {
|
|||
void LinkSymbolsVisitor::Visit(Namespace* node) {
|
||||
// Visitor::Visit(&node->type); // not needed
|
||||
|
||||
auto maybe_type = namespace_visitor_.FindType(std::nullopt, node->type); // TODO: find only in local namespace
|
||||
auto maybe_typeclass = namespace_visitor_.FindType(std::nullopt, node->type); // TODO: find only if in global namespace
|
||||
std::optional<utils::IdType> maybe_type = namespace_visitor_.FindLocalType(node->type);
|
||||
|
||||
std::optional<utils::IdType> maybe_typeclass;
|
||||
if (namespace_visitor_.GetCurrentPath().size() == 0) {
|
||||
maybe_typeclass = namespace_visitor_.FindTypeclass(node->type);
|
||||
}
|
||||
|
||||
if (maybe_type.has_value() && maybe_typeclass.has_value()) {
|
||||
error_handling::HandleTypecheckError("Ambigious namespace name (typeclass or type)");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue