diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-07 14:44:16 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-07 14:44:16 +0330 |
commit | 62b7af496f2c694ff5361cf21042bbe14f969c64 (patch) | |
tree | 4c9b32af2d2baa49ad9941fc73a90133e1c27a77 /src/compiler | |
parent | 1f73f7e22c207fa72391253e21332e02d055bd72 (diff) |
add more type stuff
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/ast-tree.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compiler/ast-tree.c b/src/compiler/ast-tree.c index 0dc5424..55209c4 100644 --- a/src/compiler/ast-tree.c +++ b/src/compiler/ast-tree.c @@ -1555,7 +1555,7 @@ AstTree *astTreeParseFunction(ParserNode *parserNode, AstTreeHelper *p_helper) { argument->type = type; argument->name_begin = arg_metadata->name->str_begin; argument->name_end = arg_metadata->name->str_end; - argument->isConst = false; // all arguments are not constants + argument->isConst = true; // all arguments are constants if (!pushVariable(&helper, &function->arguments, argument)) { astTreeVariableDelete(argument); @@ -2532,6 +2532,10 @@ AstTree *makeTypeOf(AstTree *value) { bool typeIsEqual(AstTree *type0, AstTree *type1) { AstTree *left = getValue(type0); AstTree *right = getValue(type1); + if (left == NULL || right == NULL) { + printLog("Can't check types"); + UNREACHABLE; + } bool ret = typeIsEqualBack(left, right); @@ -3231,6 +3235,9 @@ bool setTypesReturn(AstTree *tree, AstTreeSetTypesHelper _helper, .lookingType = getValue(function->returnType), .treeHelper = _helper.treeHelper, }; + if (helper.lookingType == NULL) { + return false; + } if (!setAllTypes(metadata->value, helper, NULL)) { return false; } @@ -3628,6 +3635,9 @@ bool setTypesComptime(AstTree *tree, AstTreeSetTypesHelper helper) { } AstTree *newTree = getValue(operand); + if (newTree == NULL) { + return false; + } if (operand != newTree) { astTreeDelete(operand); |