another minor problem fixed: only test on options['R'] once
authorceriel <none@none>
Wed, 23 Nov 1988 13:10:57 +0000 (13:10 +0000)
committerceriel <none@none>
Wed, 23 Nov 1988 13:10:57 +0000 (13:10 +0000)
in a FOR statement!

lang/m2/comp/Version.c
lang/m2/comp/node.c
lang/m2/comp/walk.c

index 7fd93f6..ac49387 100644 (file)
@@ -1 +1 @@
-static char Version[] = "ACK Modula-2 compiler Version 0.42";
+static char Version[] = "ACK Modula-2 compiler Version 0.43";
index 64b6544..df740a4 100644 (file)
@@ -100,7 +100,7 @@ printnode(nd, lvl)
        register t_node *nd;
 {
        indnt(lvl);
-       print("Class: %d; Symbol: %s\n", nd->nd_class, symbol2str(nd->nd_symb));
+       print("Class: %d; Symbol: %s; Flags: %d\n", nd->nd_class, symbol2str(nd->nd_symb), nd->nd_flags);
        if (nd->nd_type) {
                indnt(lvl);
                print("Type: ");
index 29f2ec4..82fa46b 100644 (file)
@@ -448,6 +448,8 @@ WalkStat(nd, exit_label)
 
        assert(nd->nd_class == Stat);
 
+       if (nd->nd_symb == ';') return;
+
        DoLineno(nd);
        options['R'] = (nd->nd_flags & ROPTION);
        options['A'] = (nd->nd_flags & AOPTION);
@@ -462,9 +464,6 @@ WalkStat(nd, exit_label)
                }
                break;
 
-       case ';':
-               break;
-
        case BECOMES:
                DoAssign(left, right);
                break;
@@ -574,13 +573,11 @@ WalkStat(nd, exit_label)
                                nd->nd_def->df_flags |= D_FORLOOP;
                                def_ilb(l1);
                                if (! options['R']) {
+                                       label x = ++text_label;
+
                                        ForLoopVarExpr(nd);
                                        C_stl(tmp2);
-                               }
-                               WalkNode(right, exit_label);
-                               nd->nd_def->df_flags &= ~D_FORLOOP;
-                               if (! options['R']) {
-                                       label x = ++text_label;
+                                       WalkNode(right, exit_label);
                                        C_lol(tmp2);
                                        ForLoopVarExpr(nd);
                                        C_beq(x);
@@ -588,6 +585,8 @@ WalkStat(nd, exit_label)
                                        C_trp();
                                        def_ilb(x);
                                }
+                               else    WalkNode(right, exit_label);
+                               nd->nd_def->df_flags &= ~D_FORLOOP;
                                FreeInt(tmp2);
                                if (stepsize) {
                                        C_lol(tmp);