diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-04 05:17:22 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-04 05:17:22 +0330 |
commit | f570c63542bc644d829aff8c470db2385a3c5180 (patch) | |
tree | 2ed885895510eab9bc8845d3e14b5e76c064f845 /src/compiler/ast-tree.c | |
parent | 5c0542111e67d60490c7e218b985d6c6b9eaf9f2 (diff) |
add reassignable functions in function scopes (reassignable lambdas)
Diffstat (limited to 'src/compiler/ast-tree.c')
-rw-r--r-- | src/compiler/ast-tree.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/ast-tree.c b/src/compiler/ast-tree.c index 331c7e7..77b93d6 100644 --- a/src/compiler/ast-tree.c +++ b/src/compiler/ast-tree.c @@ -886,7 +886,7 @@ AstTree *copyAstTreeBack(AstTree *tree, AstTreeVariables oldVariables[], new_metadata->expressions = a404m_malloc( new_metadata->expressions_size * sizeof(*new_metadata->expressions)); - size_t new_variables_size = variables_size + 1; + const size_t new_variables_size = variables_size + 1; AstTreeVariables new_oldVariables[new_variables_size]; AstTreeVariables new_newVariables[new_variables_size]; for (size_t i = 0; i < variables_size; ++i) { @@ -1554,12 +1554,17 @@ AstTree *astTreeParseTypeFunction(ParserNode *parserNode, if (variable_metadata->name->token != PARSER_TOKEN_IDENTIFIER) { printError(node_argument->str_begin, node_argument->str_end, "Name must be identifier"); - UNREACHABLE; + return NULL; } argument.name_begin = variable_metadata->name->str_begin; argument.name_end = variable_metadata->name->str_end; argument.type = astTreeParse(variable_metadata->type, helper); + if (variable_metadata->value != NULL) { + printError(node_argument->str_begin, node_argument->str_end, + "Cannot have value in function type"); + return NULL; + } if (argument.type == NULL) { return NULL; } |