public void Accept(WhileNode node)
 {
 }
Example #2
0
        public void Accept(WhileNode node)
        {
            var startLabel = nextLabel();
            var endLabel = nextLabel();
            method.ContinueLabels.Push(startLabel);
            method.BreakLabels.Push(endLabel);

            method.EmitLabel(node.SourceLocation, startLabel);
            node.Predicate.Visit(this);
            method.Emit(node.SourceLocation, InstructionType.JumpIfFalse, endLabel);
            node.Body.Visit(this);
            method.Emit(node.SourceLocation, InstructionType.Jump, startLabel);
            method.EmitLabel(node.SourceLocation, endLabel);
        }