Beispiel #1
0
 public void CfDoWhile_LargeBody()
 {
     var dw = new AbsynDoWhile(new List<AbsynStatement>
         {
             new AbsynAssignment(Id("foo"), m.Int32(3)),
             new AbsynAssignment(Id("foo"), m.Int32(4))
         },
         m.Lt(Id("bar"), 0));
     dw.Accept(cf);
     var sExp =
         "\tdo" + nl +
         "\t{" + nl +
             "\t\tfoo = 0x00000003;" + nl + 
             "\t\tfoo = 0x00000004;" + nl + 
         "\t} while (bar < 0x00000000);" + nl;
     Assert.AreEqual(sExp, sw.ToString());
 }
 public void VisitDoWhile(AbsynDoWhile loop)
 {
     stms.Add(loop);
 }
 public void EmitDoWhile(List<AbsynStatement> body, Expression expr)
 {
     AbsynDoWhile doWhile = new AbsynDoWhile(body, expr);
     stms.Add(doWhile);
 }
Beispiel #4
0
		public void VisitDoWhile(AbsynDoWhile loop)
		{
			writer.Indent();
			writer.WriteKeyword("do");
			writer.Terminate();
			WriteIndentedStatements(loop.Body, true);
			
			if (loop.Body.Count <= 1)
                writer.Indent();
			writer.WriteKeyword("while");
            writer.Write(" (");
			WriteExpression(loop.Condition);
			writer.Terminate(");");
		}