]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
check for TYPE_NOEXPR in general when applying an operator
authorWolfgang Bumiller <blub@speed.at>
Thu, 3 Jan 2013 11:56:26 +0000 (12:56 +0100)
committerWolfgang Bumiller <blub@speed.at>
Thu, 3 Jan 2013 11:56:26 +0000 (12:56 +0100)
parser.c

index 14b4c810dab20c866ebbffbb025f89078d223feb..f49184d65b4f09e63b6700f9c4b1b5b497dbd701 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -549,6 +549,16 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
         exprs[i]  = sy->out[vec_size(sy->out)+i].out;
         blocks[i] = sy->out[vec_size(sy->out)+i].block;
         asvalue[i] = (ast_value*)exprs[i];
+
+        if (exprs[i]->expression.vtype == TYPE_NOEXPR &&
+            !(i != 0 && op->id == opid2('?',':')))
+        {
+            if (ast_istype(exprs[i], ast_label))
+                compile_error(ast_ctx(exprs[i]), "expected expression, got an unknown identifier");
+            else
+                compile_error(ast_ctx(exprs[i]), "not an expression");
+            (void)!compile_warning(ast_ctx(exprs[i]), WARN_DEBUG, "expression %u\n", (unsigned int)i);
+        }
     }
 
     if (blocks[0] && !vec_size(blocks[0]->exprs) && op->id != opid1(',')) {