]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Simplify parse stage for unary - operator.
authorDale Weiler <killfieldengine@gmail.com>
Mon, 30 Sep 2013 02:08:09 +0000 (22:08 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Mon, 30 Sep 2013 02:08:09 +0000 (22:08 -0400)
parser.c

index b5f6fe4d3415c3489f9aee37d12c83e8932b934c..15bb921fb30d9c67039cb1a710e1e7cd3b1b54a8 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -465,15 +465,15 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
             out = exprs[0];
             break;
         case opid2('-','P'):
-            if (!(out = fold_op(parser->fold, op, exprs))) {
-                if (exprs[0]->vtype != TYPE_FLOAT &&
-                    exprs[0]->vtype != TYPE_VECTOR) {
-                        compile_error(ctx, "invalid types used in unary expression: cannot negate type %s",
-                                      type_name[exprs[0]->vtype]);
-                    return false;
-                }
-                out = (ast_expression*)ast_unary_new(ctx, (VINSTR_NEG_F-TYPE_FLOAT) + exprs[0]->vtype, exprs[0]);
+            if ((out = fold_op(parser->fold, op, exprs)))
+                break;
+            if (exprs[0]->vtype != TYPE_FLOAT &&
+                exprs[0]->vtype != TYPE_VECTOR) {
+                    compile_error(ctx, "invalid types used in unary expression: cannot negate type %s",
+                                  type_name[exprs[0]->vtype]);
+                return false;
             }
+            out = (ast_expression*)ast_unary_new(ctx, (VINSTR_NEG_F-TYPE_FLOAT) + exprs[0]->vtype, exprs[0]);
             break;
 
         case opid2('!','P'):