From 982138b8da8fca09723e93352e6fbe469e205141 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 23 Nov 1988 13:10:57 +0000 Subject: [PATCH] another minor problem fixed: only test on options['R'] once in a FOR statement! --- lang/m2/comp/Version.c | 2 +- lang/m2/comp/node.c | 2 +- lang/m2/comp/walk.c | 15 +++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lang/m2/comp/Version.c b/lang/m2/comp/Version.c index 7fd93f6c4..ac4938748 100644 --- a/lang/m2/comp/Version.c +++ b/lang/m2/comp/Version.c @@ -1 +1 @@ -static char Version[] = "ACK Modula-2 compiler Version 0.42"; +static char Version[] = "ACK Modula-2 compiler Version 0.43"; diff --git a/lang/m2/comp/node.c b/lang/m2/comp/node.c index 64b654428..df740a445 100644 --- a/lang/m2/comp/node.c +++ b/lang/m2/comp/node.c @@ -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: "); diff --git a/lang/m2/comp/walk.c b/lang/m2/comp/walk.c index 29f2ec42b..82fa46bcb 100644 --- a/lang/m2/comp/walk.c +++ b/lang/m2/comp/walk.c @@ -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); -- 2.34.1