public void Accept(IfNode node)
 {
 }
示例#2
0
        public void Accept(IfNode node)
        {
            var elseLabel = nextLabel();
            var endLabel = nextLabel();

            node.Predicate.Visit(this);
            method.Emit(node.SourceLocation, InstructionType.JumpIfFalse, elseLabel);
            node.Body.Visit(this);
            method.Emit(node.SourceLocation, InstructionType.Jump, endLabel);
            method.EmitLabel(node.SourceLocation, elseLabel);
            if (node.Children.Count > 2)
                node.ElseBody.Visit(this);
            method.EmitLabel(node.SourceLocation, endLabel);
        }