#pragma once #include "basic_nodes.hpp" #include "doc_nodes.hpp" #include "expression_nodes.hpp" #include "type_nodes.hpp" #include // IN PROGRESS namespace nodes { // IN PROGRESS: add another constructors ?? class Import : public Node { public: Import(Node node, const Identifier &import_name, const Identifier &module_name, std::vector &&symbols = {}) : Node(node), import_name_(import_name), module_name_(module_name), symbols_(std::move(symbols)) {} size_t symbols_size() const { return symbols_.size(); } std::string *get_symbol(size_t id) { return symbols_.at(id).get(); } const std::string *get_symbol(size_t id) const { return symbols_.at(id).get(); } private: Identifier import_name_; Identifier module_name_; std::vector symbols_; }; class Constraint : public Node { public: Constraint(Node node, ExpressionProxy expression) : Node(node), expression_(expression) {} Expression *get_expression() { return expression_.get(); } const Expression *get_expression() const { return expression_.get(); } private: ExpressionProxy expression_; }; class FunctionDefinition : public Node { public: enum ModifierType { STATIC, LET, VAR, }; FunctionDefinition(Node node, SymbolDocs &&docs, std::vector &&constraints, ModifierType modifier, const Identifier &name, std::vector> &&annotations, std::vector &&arguments, std::vector &&reference_types, std::vector> &&types, std::optional expression) : Node(node), docs_(std::move(docs)), constraints_(std::move(constraints)), modifier_(modifier), name_(name), annotations_(std::move(annotations)), arguments_(std::move(arguments)), reference_types_(std::move(reference_types)), types_(std::move(types)), expression_(expression) {} private: SymbolDocs docs_; std::vector constraints_; ModifierType modifier_; Identifier name_; std::vector> annotations_; std::vector arguments_; std::vector reference_types_; std::vector> types_; std::optional expression_; // std::vector optional_arguments_; // ?? }; // IN PROGRESS class TypeDefinition : public Node { public: TypeDefinition(Node node, SymbolDocs &&docs, bool is_on_heap, const Identifier &name, std::vector &&arguments, std::optional &&type, std::vector &&methods) : Node(node), docs_(std::move(docs)), is_on_heap_(is_on_heap), name_(name), arguments_(std::move(arguments)), type_(std::move(type)), methods_(std::move(methods)) {} private: SymbolDocs docs_; bool is_on_heap_; Identifier name_; std::vector arguments_; std::optional type_; // TupleType is VariantType with one variant std::vector methods_; }; // IN PROGRESS class TypeclassDefinition : public Node { public: TypeclassDefinition(Node node, SymbolDocs &&docs, const Identifier &name, std::vector &&base_typeclasses, std::vector &&methods) : Node(node), docs_(std::move(docs)), name_(name), base_typeclasses_(std::move(base_typeclasses)), methods_(std::move(methods)) {} private: SymbolDocs docs_; Identifier name_; std::vector base_typeclasses_; std::vector methods_; }; // IN PROGRESS } // namespace nodes