Пример #1
0
 public AbsynStatement VisitDoWhile(AbsynDoWhile loop)
 {
     for (int i = 0; i < loop.Body.Count; ++i)
     {
         loop.Body[i] = loop.Body[i].Accept(this);
     }
     return(loop);
 }
Пример #2
0
        public void VisitDoWhile(AbsynDoWhile loop)
        {
            writer.Indent();
            writer.WriteKeyword("do");
            writer.Terminate();
            WriteIndentedStatements(loop.Body, true);

            if (HasSmallBody(loop.Body))
            {
                writer.Indent();
            }
            writer.WriteKeyword("while");
            writer.Write(" (");
            WriteExpression(loop.Condition);
            writer.Terminate(");");
        }
Пример #3
0
        public void CfDoWhile_SmallBody()
        {
            var dw = new AbsynDoWhile(new List <AbsynStatement>
            {
                new AbsynAssignment(Id("foo"), m.Int32(3))
            },
                                      m.Lt(Id("bar"), 0));

            dw.Accept(cf);
            var sExp =
                "\tdo" + nl +
                "\t\tfoo = 0x00000003;" + nl +
                "\twhile (bar < 0x00000000);" + nl;

            Assert.AreEqual(sExp, sw.ToString());
        }
Пример #4
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 = 3<i32>;" + nl +
                "\t\tfoo = 4<i32>;" + nl +
                "\t} while (bar < 0<32>);" + nl;

            Assert.AreEqual(sExp, sw.ToString());
        }
Пример #5
0
        public void EmitDoWhile(List <AbsynStatement> body, Expression expr)
        {
            AbsynDoWhile doWhile = new AbsynDoWhile(body, expr);

            stms.Add(doWhile);
        }
Пример #6
0
 public void VisitDoWhile(AbsynDoWhile loop)
 {
     stms.Add(loop);
 }
Пример #7
0
 public bool VisitDoWhile(AbsynDoWhile loop)
 {
     return(false);
 }