other symbol for reference types, any references in reference type

This commit is contained in:
ProgramSnail 2023-08-13 16:19:47 +03:00
parent fe6507ae12
commit 7f3dfd71a1
6 changed files with 14 additions and 16 deletions

View file

@ -174,18 +174,19 @@ parser::ParseTree::Node collect_symbol_doc_nodes(
return current_node;
}
// definition_info? annotation_info* '^'? (simple_type_identifier | typeclass)
// definition_info? annotation_info* '<>'? (simple_type_identifier | typeclass)
// (argument_type* '=' type)? ';'
nodes::TypeDefinition build_type_definition(parser::ParseTree::Node parser_node,
nodes::TypeStorage &type_storage) {
bool is_on_heap = parser_node.nth_child(0).get_value() == "^";
std::optional<parser::ParseTree::Node> description_node;
std::vector<parser::ParseTree::Node> annotation_nodes;
auto name_node = collect_symbol_doc_nodes(parser_node.nth_named_child(0),
description_node, annotation_nodes);
bool is_on_heap = !name_node.previous_sibling().is_null() &&
name_node.previous_sibling().get_value() == "<>";
nodes::Identifier name = build_identifier(name_node);
bool is_typeclass = (name.get_type() == nodes::Identifier::TYPECLASS);

View file

@ -87,13 +87,12 @@ nodes::TypeProxy build_array_type(parser::ParseTree::Node parser_node,
build_node(parser_node));
}
// TODO: add different reference types
// '^' type
// _reference_ type
nodes::TypeProxy build_reference_type(parser::ParseTree::Node parser_node,
nodes::TypeStorage &type_storage) {
nodes::TypeProxy type =
build_type(parser_node.nth_named_child(0), type_storage);
type.get()->set_modifier(nodes::Modifier::REF);
type.get()->set_modifier(build_modifier(parser_node.nth_child(0)));
return type;
}