public override void CaseASwitchCaseStm(ASwitchCaseStm node) { AABlock block = (AABlock)node.GetBlock(); Token token; if (node.GetType() is ACaseSwitchCaseType) { token = ((ACaseSwitchCaseType)node.GetType()).GetToken(); } else { token = ((ADefaultSwitchCaseType)node.GetType()).GetToken(); } block.SetToken(new TRBrace("{", token.Line, token.Pos)); base.CaseASwitchCaseStm(node); }
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); }