part of typeclass_graph

This commit is contained in:
ProgramSnail 2023-05-14 13:05:46 +03:00
parent 4f54bb4bd7
commit 9aeba7b0de
8 changed files with 154 additions and 68 deletions

View file

@ -41,6 +41,7 @@ public:
void AddEnterNamespace(const std::string& name,
utils::ClassInternalsModifier modifier,
std::optional<interpreter::tokens::Namespace*> node,
const interpreter::tokens::BaseNode& base_node);
void EnterNamespace(const std::string& name,
@ -204,9 +205,17 @@ public:
return current_path_;
}
utils::IdType GetCurrentNamespace() {
utils::IdType GetCurrentNamespaceId() {
return namespace_stack_.back();
}
definition::Namespace* GetCurrentNamespace() {
return &global_info_.namespaces_[GetCurrentNamespaceId()];
}
bool IsInGlobalNamespace() {
return namespace_stack_.size() == 1;
}
private:
NamespaceVisitor(GlobalInfo& global_info) : global_info_(global_info),
namespace_stack_ {global_info.GlobalNamespaceId} {}
@ -291,6 +300,15 @@ public:
return &typeclass_graph_;
}
std::optional<utils::IdType> AddTypeclassToGraph(utils::IdType typeclass);
private:
void CollectFunctionInfo(
utils::IdType current_namespace,
utils::ClassInternalsModifier modifier,
std::vector<std::pair<std::string, std::pair<utils::ClassInternalsModifier, interpreter::tokens::FunctionDeclaration*>>>& function_declarations,
std::vector<std::pair<std::string, interpreter::tokens::FunctionDefinitionStatement*>>& function_definitions);
private:
const utils::IdType GlobalNamespaceId = 0;