Author: mesyeti <mesyeti@mesyeti.uk>
fix some compiler bugs
basic-std/std/string.bas | 4 ---- basic/source/frontend/c89.c | 2 +- basic/source/parser.c | 7 +++++++ basic/source/semanticAnalysis.c | 2 +-
diff --git a/basic/source/frontend/c89.c b/basic/source/frontend/c89.c index 33d890c1094c16e7ac0a8ff60ecef41f9496f0d7..638c918ec87e07bd80566659e5cea48ca614527b 100644 --- a/basic/source/frontend/c89.c +++ b/basic/source/frontend/c89.c @@ -92,7 +92,7 @@ UsedType usedType = SemanticAnalysis_NodeAsUsedType(node->varType); Type* type = &state.types[usedType.typeIdx]; CompileType(node->varType); - fprintf(out, " %s = %s;\n", node->name, type->type == TYPE_PRIM? "0" : "{0}"); + fprintf(out, " nitron_%s = %s;\n", node->name, type->type == TYPE_PRIM? "0" : "{0}"); } static void CompileExprNode(Node* node); diff --git a/basic/source/parser.c b/basic/source/parser.c index a71dc8d423b5fd1d7423df351e5a29485862c3fc..91481eae18cdc53e93bed8a7d93f99843ef21ee9 100644 --- a/basic/source/parser.c +++ b/basic/source/parser.c @@ -461,6 +461,10 @@ Expect(p, TOKEN_RSQUARE); Advance(p); } + else { + ret.array = false; + ret.arrayLen = NULL; + } Expect(p, TOKEN_AS); @@ -590,6 +594,9 @@ Advance(p); ret.body = ParseBody(p, &ret.bodyLen); Expect(p, TOKEN_END); + + Advance(p); + Expect(p, TOKEN_LINE); Node node; node.whileStat = ret; diff --git a/basic/source/semanticAnalysis.c b/basic/source/semanticAnalysis.c index 8363fbc73b6da5348e71e8c4ce888d427084c49c..eef204090345ff1a5308d5e180ffb6018027d02c 100644 --- a/basic/source/semanticAnalysis.c +++ b/basic/source/semanticAnalysis.c @@ -605,7 +605,7 @@ } UsedType type = SemanticAnalysis_EvalType(node->ret.node); - if (AssignCompatible(thisFunc->ret, type)) { + if (!AssignCompatible(thisFunc->ret, type)) { PrintError(node->i.err, "Return type does not match function type"); } return GET_PRIM("unit", 0); diff --git a/basic-std/std/string.bas b/basic-std/std/string.bas index 7846d0e933f514872229c0524e98165f35fc1b9f..4e1559e54c2e65a86589a9216d4f5aa32328eb9f 100644 --- a/basic-std/std/string.bas +++ b/basic-std/std/string.bas @@ -10,7 +10,3 @@ end return ret end - -func StringEq(str1 as ptr(char), str2 as ptr(char)) bool - -end