abstract type graph added to symbol table

This commit is contained in:
ProgramSnail 2023-04-17 12:09:02 +03:00
parent 25355974a2
commit 3c643d2759
8 changed files with 845 additions and 16 deletions

View file

@ -6,6 +6,7 @@
// for clangd
#include "symbols_info.hpp"
#include "type_graph.hpp"
#include "utils.hpp"
namespace info {
@ -54,6 +55,14 @@ public:
std::optional<utils::IdType> FindTypeclass(const std::optional<std::vector<std::string>>& path,
const std::string typeclass);
NamespaceVisitor CreateVisitor() {
return global_info_.CreateVisitor();
}
TypeGraph* GetAbstractTypeGraph() {
return global_info_.GetAbstractTypeGraph();
}
private:
NamespaceVisitor(GlobalInfo& global_info) : global_info_(global_info),
namespace_stack_({&global_info.global_namespace_}) {}
@ -74,6 +83,10 @@ public:
return NamespaceVisitor(*this);
}
TypeGraph* GetAbstractTypeGraph() {
return &abstract_type_graph_;
}
// TODO: remember about vector realloc
FunctionInfo* GetFunctionInfo(utils::IdType id) {
return &functions_[id];
@ -94,6 +107,8 @@ private:
std::vector<TypeInfo> types_;
std::vector<TypeclassInfo> typeclasses_;
info::TypeGraph abstract_type_graph_;
NamespaceInfo global_namespace_;
std::vector<ImportInfo> imports_;
std::unordered_map<std::string, ImportInfo> usages_;