package chocopy.common.astnodes; import chocopy.common.analysis.NodeAnalyzer; import java_cup.runtime.ComplexSymbolFactory.Location; import java.util.List; /** Conditional statement. */ public class IfStmt extends Stmt { /** Test condition. */ public final Expr condition; /** "True" branch. */ public final List thenBody; /** "False" branch. */ public final List elseBody; /** * The AST for if CONDITION: THENBODY else: ELSEBODY spanning source locations [LEFT..RIGHT]. */ public IfStmt( Location left, Location right, Expr condition, List thenBody, List elseBody) { super(left, right); this.condition = condition; this.thenBody = thenBody; this.elseBody = elseBody; } public T dispatch(NodeAnalyzer analyzer) { return analyzer.analyze(this); } }