Exemplo n.º 1
0
        public override void Visit(DoWhileLoop visitable)
        {
            WriteIndentantion(true).AppendLine("Do-while loop");

            WriteIndentantion(true).AppendLine("Body:");
            Start(visitable.Body);
            _indentLevel--;

            WriteIndentantion(true).AppendLine("Condition:");
            Start(visitable.Condition);
            _indentLevel--;

            _indentLevel--;
        }
Exemplo n.º 2
0
        public static void Compile(ByteCodeCompiler bcc, ParserContext parser, ByteBuffer buffer, DoWhileLoop doWhileLoop)
        {
            ByteBuffer loopBody = new ByteBuffer();

            bcc.Compile(parser, loopBody, doWhileLoop.Code);
            loopBody.ResolveContinues(true); // continues should jump to the condition, hence the true.

            ByteBuffer condition = new ByteBuffer();

            bcc.CompileExpression(parser, condition, doWhileLoop.Condition, true);
            loopBody.Concat(condition);
            loopBody.Add(doWhileLoop.Condition.FirstToken, OpCode.JUMP_IF_TRUE, -loopBody.Size - 1);
            loopBody.ResolveBreaks();

            buffer.Concat(loopBody);
        }
Exemplo n.º 3
0
 public abstract void Visit(DoWhileLoop visitable);