improvements for the , (comma) operator
authorceriel <none@none>
Mon, 23 Oct 1989 13:45:19 +0000 (13:45 +0000)
committerceriel <none@none>
Mon, 23 Oct 1989 13:45:19 +0000 (13:45 +0000)
lang/cem/cemcom/arith.c
lang/cem/cemcom/eval.c

index 19a9a9f..0a169c5 100644 (file)
@@ -412,10 +412,17 @@ opnd2test(expp, oper)
        register struct expr **expp;
 {
        opnd2logical(expp, oper);
-       if ((*expp)->ex_class == Oper && is_test_op((*expp)->OP_OPER))
-               { /* It is already a test */ }
-       else
-               ch7bin(expp, NOTEQUAL, intexpr((arith)0, INT));
+       if ((*expp)->ex_class == Oper) {
+               if (is_test_op((*expp)->OP_OPER)) {
+                       /* It is already a test */
+                       return;
+               }
+               if ((*expp)->OP_OPER == ',') {
+                       opnd2test(&((*expp)->OP_RIGHT), oper);
+                       return;
+               }
+       }
+       ch7bin(expp, NOTEQUAL, intexpr((arith)0, INT));
 }
 
 int
index 352d10a..6478a2a 100644 (file)
@@ -526,7 +526,7 @@ EVAL(expr, val, code, true_label, false_label)
                        break;
                case ',':
                        EVAL(left, RVAL, FALSE, NO_LABEL, NO_LABEL);
-                       EVAL(right, RVAL, gencode, NO_LABEL, NO_LABEL);
+                       EVAL(right, RVAL, gencode, true_label, false_label);
                        break;
                case '~':
                        EVAL(right, RVAL, gencode, NO_LABEL, NO_LABEL);