fix MAD compilation of C-style for loop
Gerard Goossen [Wed, 21 Mar 2007 19:18:52 +0000 (20:18 +0100)]
Subject:  [PATCH] MAD C-style for loop
Message-Id:  <20070321181852.GD31539@ostwald>

p4raw-id: //depot/perl@30676

perly.act
perly.y

index 8d4b5f8..02aa650 100644 (file)
--- a/perly.act
+++ b/perly.act
@@ -325,7 +325,7 @@ case 2:
                          forop = newUNOP(OP_NULL, 0, append_elem(OP_LINESEQ,
                                newSTATEOP(0,
                                           CopLABEL_alloc(((ps[(1) - (12)].val.p_tkval))->tk_lval.pval),
-                                          ((ps[(5) - (12)].val.opval) ? newOP(OP_NULL, 0) : (ps[(5) - (12)].val.opval)) ),
+                                          ((ps[(5) - (12)].val.opval) ? (ps[(5) - (12)].val.opval) : newOP(OP_NULL, 0)) ),
                                forop));
 
                          token_getmad((ps[(2) - (12)].val.i_tkval),forop,'3');
diff --git a/perly.y b/perly.y
index 2abf7a1..9ca64a8 100644 (file)
--- a/perly.y
+++ b/perly.y
@@ -391,7 +391,7 @@ loop        :       label WHILE '(' remember texpr ')' mintro mblock cont
                          forop = newUNOP(OP_NULL, 0, append_elem(OP_LINESEQ,
                                newSTATEOP(0,
                                           CopLABEL_alloc(($1)->tk_lval.pval),
-                                          ($5 ? newOP(OP_NULL, 0) : $5) ),
+                                          ($5 ? $5 : newOP(OP_NULL, 0)) ),
                                forop));
 
                          token_getmad($2,forop,'3');