From ab37cb133455ff903da3f4f57a8bdf445211222c Mon Sep 17 00:00:00 2001 From: IceCapriccio Date: Mon, 10 Dec 2018 11:21:46 +0800 Subject: [PATCH] =?UTF-8?q?for=20=E5=BE=AA=E7=8E=AF=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E6=9C=80=E5=90=8E=E7=9A=84=20goto=20=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IntermediateCodeGenerate.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/IntermediateCodeGenerate.cpp b/IntermediateCodeGenerate.cpp index ea638f1..601d78b 100644 --- a/IntermediateCodeGenerate.cpp +++ b/IntermediateCodeGenerate.cpp @@ -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++; @@ -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; }