#pragma once #include "interpreter_tree.hpp" #include #include #include #include #include #include // for clangd #include "utils.hpp" namespace interpreter { class Node; } // namespace interpreter namespace info { struct VariantTypeInfo; struct TupleTypeInfo; struct AliasTypeInfo; struct TypeInfo; struct TypeclassInfo; enum class BuiltInTypeInfo { StringT, IntT, FloatT, UnitT, }; struct TypeUsageInfo { interpreter::tokens::TypeExpression* node; TypeInfo* info = nullptr; }; struct ParameterInfo { std::string type; std::vector typeclass_nodes; std::vector typeclass_types; }; struct AbstractTypeInfo { enum { Basic, Abstract } modifier; ParameterInfo type; }; struct AliasTypeInfo { enum {Alias, Type, Let} modifier; std::vector parameters; TypeUsageInfo value; }; struct AnyTypeInfo { ParameterInfo type; std::vector parameters; interpreter::tokens::AnyType* value; }; struct TypeInfo { std::variant type; }; struct ConstructorInfo { std::string name; size_t order; utils::IdType type_id; }; struct FunctionDeclarationInfo { std::vector parameters; std::vector argument_type_nodes; std::vector argument_types; interpreter::tokens::FunctionDeclaration* node = nullptr; }; struct FunctionDefinitionInfo { std::vector parameters; std::vector argument_names; interpreter::tokens::FunctionDefinitionStatement* node = nullptr; }; struct FunctionInfo { size_t argument_count = 0; std::optional declaration; std::optional definition; }; struct TypeclassInfo { std::vector parameters; std::vector requirements; }; struct ImportInfo { std::string module_name; std::vector symbols; }; struct NamespaceInfo { enum Modifier { Const, Var }; std::unordered_map types; std::unordered_map typeclasses; std::unordered_map functions; std::unordered_map constructors; std::unordered_map namespaces; std::unordered_map> variable_namespaces; std::optional modifier; std::optional variable; std::string type_name; TypeInfo* type_info = nullptr; }; } // namespace info