mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-09 08:28:43 +00:00
.
This commit is contained in:
parent
648f78afa3
commit
496d3819d9
6 changed files with 71 additions and 16 deletions
|
|
@ -167,7 +167,7 @@ utils::IdType GlobalInfo::NamespaceVisitor::AddAbstractType(const std::string& a
|
|||
if (!FindAbstractType(abstract_type).has_value()) {
|
||||
size_t id = global_info_.abstract_types_.size();
|
||||
global_info_.name_to_abstract_type_[abstract_type] = id;
|
||||
global_info_.abstract_types_.push_b(ack(std::move(abstract_type_info));
|
||||
global_info_.abstract_types_.push_back(std::move(abstract_type_info));
|
||||
}
|
||||
|
||||
error_handling::HandleTypecheckError("More then one abstract type with the same name in namespace");
|
||||
|
|
@ -261,6 +261,16 @@ std::optional<utils::IdType> GlobalInfo::NamespaceVisitor::FindType(
|
|||
});
|
||||
}
|
||||
|
||||
std::optional<utils::IdType> GlobalInfo::NamespaceVisitor::FindLocalType(const std::string& type) {
|
||||
auto type_id_iter = namespace_stack_.back()->types.find(type);
|
||||
|
||||
if (type_id_iter != namespace_stack_.back()->types.end()) {
|
||||
return type_id_iter->second;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<utils::IdType> GlobalInfo::NamespaceVisitor::FindAbstractType(const std::string& abstract_type) {
|
||||
auto abstract_type_id_iter = global_info_.name_to_abstract_type_.find(abstract_type);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue