Skip to content

Commit

Permalink
for 循环加上最后的 goto 语句
Browse files Browse the repository at this point in the history
  • Loading branch information
IceCapriccio committed Dec 10, 2018
1 parent 24cdae9 commit ab37cb1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions IntermediateCodeGenerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ CodeSequence Visitor::VisitSentence(AbstractSyntaxTreeNode *root) {
} else if (root->child[0]->info.value == "ForSentence") { // Sentence -> ForSentence
ForCode = VisitForSentence(root->child[0], next);
code.push_back(ForCode);
supportTable.LabelAssign(next, total);
CodeTerm codeTerm(DefLabel, -1, -1, next);
code.push_back(codeTerm);
total++;
Expand Down Expand Up @@ -276,6 +277,8 @@ CodeSequence Visitor::VisitForSentence(AbstractSyntaxTreeNode *root, int ForSent
total++;
}
codeTerm = CodeTerm(Goto, -1, -1, expression2_begin);
code.push_back(codeTerm);
total++;
return code;
}

Expand Down

0 comments on commit ab37cb1

Please sign in to comment.