public override void CaseAContinueStm(AContinueStm node) { AForStm forStm = Util.GetAncestor <AForStm>(node); AABlock pBlock; if (!(node.Parent() is AABlock)) { pBlock = new AABlock(new ArrayList(), new TRBrace("}", node.GetToken().Line, node.GetToken().Pos)); ABlockStm blockStm = new ABlockStm(new TLBrace("{", node.GetToken().Line, node.GetToken().Pos), pBlock); node.ReplaceBy(blockStm); pBlock.GetStatements().Add(node); } pBlock = (AABlock)node.Parent(); pBlock.GetStatements().Insert(pBlock.GetStatements().IndexOf(node), forStm.GetUpdate().Clone()); }
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) { //Ignore it. }