public override void CaseAForStm(AForStm node) { //Replace with while node.GetBody().Apply(new ReworkForContinues()); AABlock innerBlock = new AABlock(); innerBlock.SetToken(new TRBrace("{", node.GetToken().Line, node.GetToken().Pos)); innerBlock.GetStatements().Add(node.GetBody()); innerBlock.GetStatements().Add(node.GetUpdate()); ABlockStm innerBlockStm = new ABlockStm(new TLBrace(";"), innerBlock); AWhileStm whileStm = new AWhileStm(node.GetToken(), node.GetCond(), innerBlockStm); AABlock block = new AABlock(); block.SetToken(new TRBrace("{", whileStm.GetToken().Line, whileStm.GetToken().Pos)); block.GetStatements().Add(node.GetInit()); block.GetStatements().Add(whileStm); ABlockStm blockStm = new ABlockStm(null, block); node.ReplaceBy(blockStm); blockStm.Apply(this); }
public override void CaseAForStm(AForStm node) { InAForStm(node); if (node.GetBody() != null) { node.GetBody().Apply(this); } if (node.GetUpdate() != null) { node.GetUpdate().Apply(this); } if (node.GetCond() != null) { node.GetCond().Apply(this); } if (node.GetInit() != null) { node.GetInit().Apply(this); } if (node.GetToken() != null) { node.GetToken().Apply(this); } OutAForStm(node); }