mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-25 13:07:13 +00:00
typeclasses can have required methods and required functions
This commit is contained in:
parent
562541087e
commit
4882d458f8
11 changed files with 113 additions and 43 deletions
|
|
@ -78,7 +78,8 @@ struct Function {
|
|||
|
||||
struct Typeclass {
|
||||
std::vector<Parameter> parameters;
|
||||
std::vector<FunctionDeclaration> requirements;
|
||||
std::vector<FunctionDeclaration> function_requirements;
|
||||
std::vector<FunctionDeclaration> method_requirements;
|
||||
};
|
||||
|
||||
struct Import {
|
||||
|
|
|
|||
|
|
@ -355,7 +355,8 @@ struct TypeclassDefinitionStatement {
|
|||
BaseNode base;
|
||||
|
||||
std::unique_ptr<TypeDefinition> definition;
|
||||
std::vector<std::unique_ptr<FunctionDeclaration>> requirements;
|
||||
std::vector<std::unique_ptr<FunctionDeclaration>> method_requirements;
|
||||
std::vector<std::unique_ptr<FunctionDeclaration>> function_requirements;
|
||||
|
||||
utils::IdType typeclass_id_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public:
|
|||
Node NthChild(size_t n) {
|
||||
return Node(ts_node_child(node_, n), source_);
|
||||
}
|
||||
|
||||
size_t ChildCount() {
|
||||
return ts_node_child_count(node_);
|
||||
}
|
||||
|
|
@ -86,6 +87,14 @@ public:
|
|||
return Node(ts_node_child_by_field_name(node_, name.c_str(), name.size()), source_);
|
||||
}
|
||||
|
||||
Node PreviousSibling() {
|
||||
return Node(ts_node_prev_sibling(node_), source_);
|
||||
}
|
||||
|
||||
Node PreviousNamedSibling() {
|
||||
return Node(ts_node_prev_named_sibling(node_), source_);
|
||||
}
|
||||
|
||||
Node NextSibling() {
|
||||
return Node(ts_node_next_sibling(node_), source_);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue