This commit is contained in:
ProgramSnail 2023-05-02 16:16:55 +03:00
parent 648f78afa3
commit 496d3819d9
6 changed files with 71 additions and 16 deletions

View file

@ -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)");
}