partition syntax changed, interface modifier added

This commit is contained in:
ProgramSnail 2023-05-07 22:58:15 +03:00
parent 3fca384446
commit b1aff1935d
22 changed files with 299 additions and 266 deletions

View file

@ -223,6 +223,25 @@ utils::IdType GlobalInfo::NamespaceVisitor::AddConstructor(const std::string& co
return 0;
}
utils::IdType GlobalInfo::NamespaceVisitor::AddPartition(const std::vector<std::string>& path,
const std::string& name,
interpreter::tokens::PartitionStatement* node) {
PartitionInfo partition;
partition.path.reserve(current_path_.size() + path.size());
partition.path = current_path_;
for (auto& path_namespace : path) {
partition.path.push_back(path_namespace);
}
partition.name = name;
partition.node = node;
global_info_.partitions_.push_back(partition);
return global_info_.partitions_.size() - 1;
}
std::optional<definition::Namespace*> GlobalInfo::NamespaceVisitor::FindNamespace(const std::optional<std::vector<std::string>>& path) {
return FindSomething<definition::Namespace*>(path,
[] (definition::Namespace* current_namespace) -> std::optional<definition::Namespace*> {