mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-25 13:07:13 +00:00
part of typeclass_graph
This commit is contained in:
parent
4f54bb4bd7
commit
9aeba7b0de
8 changed files with 154 additions and 68 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue