#pragma once #include #include #include #include #include #include // for clangd #include "interpreter_tree.hpp" #include "utils.hpp" namespace interpreter { class Node; } // namespace interpreter namespace info::definition { struct Namespace; struct TypeUsage { interpreter::tokens::TypeExpression* node; }; struct Parameter { std::string type; std::vector typeclass_nodes; interpreter::tokens::AnyAnnotatedType* node = nullptr; }; struct AbstractType { utils::AbstractTypeModifier modifier; Parameter type; }; struct AliasType { utils::AliasModifier modifier; std::vector parameters; TypeUsage value; interpreter::tokens::AliasDefinitionStatement* node = nullptr; }; struct AnyType { Parameter type; std::vector parameters; interpreter::tokens::AnyType* value; utils::ClassModifier modifier; utils::IdType parent_namespace = 0; }; struct Type { std::variant type; }; struct Constructor { std::string name; std::optional order; // no order for tuple types utils::IdType type_id = 0; std::optional constructor_tuple_node; }; struct FunctionDeclaration { std::vector parameters; std::vector argument_types; interpreter::tokens::FunctionDeclaration* node = nullptr; }; struct FunctionDefinition { std::vector argument_names; interpreter::tokens::FunctionDefinitionStatement* node = nullptr; }; struct Function { size_t argument_count = 0; std::optional declaration; std::optional definition; }; struct Typeclass { std::vector parameters; interpreter::tokens::TypeclassDefinitionStatement* node; utils::IdType parent_namespace = 0; utils::IdType graph_id_ = 0; // TODO: make safe?? }; struct Import { std::string module_name; std::vector symbols; // size == 0 => all symbols imported }; struct Namespace { std::unordered_map types; std::unordered_map functions; std::unordered_map constructors; std::unordered_map namespaces; std::unordered_map var_namespaces; std::unordered_map const_namespaces; utils::IdType parent_namespace = 0; utils::ClassInternalsModifier modifier = utils::ClassInternalsModifier::Static; std::string type_name; // all nodes have same info std::optional any_node; }; } // namespace info::definition