mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-25 13:07:13 +00:00
type structs -> type classes
This commit is contained in:
parent
a512a92f92
commit
648f78afa3
14 changed files with 638 additions and 383 deletions
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
// for clangd
|
||||
#include "definitions.hpp"
|
||||
#include "type_manager.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace info {
|
||||
|
|
@ -38,6 +37,9 @@ public:
|
|||
|
||||
utils::IdType AddType(const std::string& type, definition::Type&& type_info);
|
||||
|
||||
utils::IdType AddAbstractType(const std::string& abstract_type,
|
||||
definition::AbstractType&& abstract_type_info);
|
||||
|
||||
utils::IdType AddTypeclass(const std::string& typeclass, definition::Typeclass&& typeclass_info);
|
||||
|
||||
utils::IdType AddConstructor(const std::string& constructor,
|
||||
|
|
@ -55,20 +57,17 @@ public:
|
|||
std::optional<utils::IdType> FindType(const std::optional<std::vector<std::string>>& path,
|
||||
const std::string& type);
|
||||
|
||||
std::optional<utils::IdType> FindTypeclass(const std::optional<std::vector<std::string>>& path,
|
||||
const std::string& typeclass);
|
||||
std::optional<utils::IdType> FindAbstractType(const std::string& abstract_type);
|
||||
|
||||
std::optional<utils::IdType> FindTypeclass(const std::string& typeclass);
|
||||
|
||||
std::optional<utils::IdType> FindConstructor(const std::optional<std::vector<std::string>>& path,
|
||||
const std::string& typeclass);
|
||||
const std::string& constructor);
|
||||
|
||||
NamespaceVisitor CreateVisitor() {
|
||||
return global_info_.CreateVisitor();
|
||||
}
|
||||
|
||||
type::TypeManager* GetTypeManager() {
|
||||
return global_info_.GetTypeManager();
|
||||
}
|
||||
|
||||
GlobalInfo* GetGlobalInfo() {
|
||||
return &global_info_;
|
||||
}
|
||||
|
|
@ -97,10 +96,6 @@ public:
|
|||
return NamespaceVisitor(*this);
|
||||
}
|
||||
|
||||
type::TypeManager* GetTypeManager() {
|
||||
return &type_manager_;
|
||||
}
|
||||
|
||||
// TODO: remember about vector realloc
|
||||
definition::Function* GetFunctionInfo(utils::IdType id) {
|
||||
return &functions_[id];
|
||||
|
|
@ -124,10 +119,12 @@ public:
|
|||
private:
|
||||
std::vector<definition::Function> functions_;
|
||||
std::vector<definition::Type> types_;
|
||||
std::vector<definition::AbstractType> abstract_types_;
|
||||
std::vector<definition::Typeclass> typeclasses_;
|
||||
std::vector<definition::Constructor> constructors_;
|
||||
|
||||
type::TypeManager type_manager_;
|
||||
std::unordered_map<std::string, utils::IdType> name_to_typeclass_;
|
||||
std::unordered_map<std::string, utils::IdType> name_to_abstract_type_;
|
||||
|
||||
definition::Namespace global_namespace_;
|
||||
std::vector<definition::Import> imports_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue