浏览代码

fix `True not False` bug

blueloveTH 1 年之前
父节点
当前提交
5a47ae6f42
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/compiler/compiler.c

+ 3 - 1
src/compiler/compiler.c

@@ -1400,7 +1400,9 @@ static Error* parse_expression(Compiler* self, int precedence, bool allow_slice)
         TokenIndex op = curr()->type;
         advance();
         PrattCallback infix = rules[op].infix;
-        assert(infix != NULL);
+        if(infix == NULL){
+            return SyntaxError(self, "expected an expression, got %s", TokenSymbols[op]);
+        }
         check(infix(self));
     }
     return NULL;