package dspl.intermediate.instructions;

import dspl.intermediate.Comparison;
import dspl.intermediate.variable.Variable;

public class BranchInstruction extends Instruction {
	/**
	 * Contains the binary comparison which if true, the ifInstructions are evaluated, else, the elseInstructions are evaluated<br>
	 */
	public Comparison comp;
	
	/**
	 * Instructions to be executed if the "if" statement is true
	 */
	public Instruction ifInst; 
	
	/**
	 * Instructions to be executed if hte "if" statement is not true (the else portion to be evaluated)
	 */
	public Instruction elseInst; 
	
	public BranchInstruction(Comparison comp, Instruction ifInst, Instruction elseInst) {
		this.comp = comp; 
		this.ifInst = ifInst;
		this.elseInst = elseInst; 
	}
	
	public boolean usesVariable(Variable v) {
		return false;
	}

	public int getInstType() {
		return Instruction.INST_TYPE_BRANCH; 
	}
}
