1 32 package org.jruby.ast; 33 34 import java.util.List ; 35 36 import org.jruby.ast.visitor.NodeVisitor; 37 import org.jruby.evaluator.Instruction; 38 import org.jruby.lexer.yacc.ISourcePosition; 39 40 44 public class IfNode extends Node { 45 static final long serialVersionUID = -163780144332979551L; 46 47 private final Node condition; 48 private final Node thenBody; 49 private final Node elseBody; 50 51 public IfNode(ISourcePosition position, Node condition, Node thenBody, Node elseBody) { 52 super(position, NodeTypes.IFNODE); 53 this.condition = condition; 54 this.thenBody = thenBody; 55 this.elseBody = elseBody; 56 } 57 58 62 public Instruction accept(NodeVisitor iVisitor) { 63 return iVisitor.visitIfNode(this); 64 } 65 66 70 public Node getCondition() { 71 return condition; 72 } 73 74 78 public Node getElseBody() { 79 return elseBody; 80 } 81 82 86 public Node getThenBody() { 87 return thenBody; 88 } 89 90 public List childNodes() { 91 return Node.createList(condition, thenBody, elseBody); 92 } 93 94 } 95 | Popular Tags |