mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-25 00:08:45 +00:00
function type
This commit is contained in:
parent
7f3dfd71a1
commit
fa01d36a84
10 changed files with 87 additions and 64 deletions
|
|
@ -382,6 +382,7 @@ nodes::FunctionDefinition build_function_definition(
|
|||
break;
|
||||
case tokens::Type::VARIANT_TYPE:
|
||||
case tokens::Type::TUPLE_TYPE:
|
||||
case tokens::Type::FUNCTION_TYPE:
|
||||
case tokens::Type::ARRAY_TYPE:
|
||||
case tokens::Type::REFERENCE_TYPE:
|
||||
case tokens::Type::MODIFIED_TYPE:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ nodes::TypeProxy build_type(parser::ParseTree::Node parser_node,
|
|||
return build_variant_type(parser_node, type_storage);
|
||||
case tokens::Type::TUPLE_TYPE:
|
||||
return build_tuple_type(parser_node, type_storage);
|
||||
case tokens::Type::FUNCTION_TYPE:
|
||||
return build_function_type(parser_node, type_storage);
|
||||
case tokens::Type::ARRAY_TYPE:
|
||||
return build_array_type(parser_node, type_storage);
|
||||
case tokens::Type::REFERENCE_TYPE:
|
||||
|
|
@ -78,6 +80,13 @@ nodes::TypeProxy build_tuple_type(parser::ParseTree::Node parser_node,
|
|||
builtin::types::Type::TUPLE);
|
||||
}
|
||||
|
||||
// '((' (annotation? type)+ '))'
|
||||
nodes::TypeProxy build_function_type(parser::ParseTree::Node parser_node,
|
||||
nodes::TypeStorage &type_storage) {
|
||||
return build_container_type(parser_node, type_storage,
|
||||
builtin::types::Type::FUNCTION);
|
||||
}
|
||||
|
||||
// '[[' type ']]'
|
||||
nodes::TypeProxy build_array_type(parser::ParseTree::Node parser_node,
|
||||
nodes::TypeStorage &type_storage) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue