Translate
Class Exp.Cx.IfThenElseExp

java.lang.Object
  extended by Translate.Exp
      extended by Translate.Exp.Cx
          extended by Translate.Exp.Cx.IfThenElseExp
Enclosing class:
Exp.Cx

public static class Exp.Cx.IfThenElseExp
extends Exp.Cx

A wrapper for short-circuiting conditional expressions (e.g., &&, ||).


Nested Class Summary
 
Nested classes/interfaces inherited from class Translate.Exp.Cx
Exp.Cx.IfThenElseExp, Exp.Cx.Rel
 
Nested classes/interfaces inherited from class Translate.Exp
Exp.Cx, Exp.Ex, Exp.Nx
 
Constructor Summary
Exp.Cx.IfThenElseExp(Exp c, Exp t, Exp f)
          Wrap the expressions and return the wrapper.
 
Method Summary
 Tree.Stm unCx(Temp.Label tt, Temp.Label ff)
          If cond is true then evaluate thenExp, otherwise if cond is false evaluate elseExp.
 Tree.Exp unEx()
          Unwrap this expression, to obtain tree code that computes a value.
 Tree.Stm unNx()
          Unwrap this expression, to obtain tree code that should be executed only for its side-effects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Exp.Cx.IfThenElseExp

public Exp.Cx.IfThenElseExp(Exp c,
                            Exp t,
                            Exp f)
Wrap the expressions and return the wrapper.

Parameters:
c - condition expression
t - then expression
f - else expression
Method Detail

unEx

public Tree.Exp unEx()
Description copied from class: Exp
Unwrap this expression, to obtain tree code that computes a value.

Overrides:
unEx in class Exp.Cx
Returns:
the tree code that computes the value

unNx

public Tree.Stm unNx()
Description copied from class: Exp
Unwrap this expression, to obtain tree code that should be executed only for its side-effects.

Overrides:
unNx in class Exp.Cx
Returns:
the tree code to be executed for its side-effects

unCx

public Tree.Stm unCx(Temp.Label tt,
                     Temp.Label ff)
If cond is true then evaluate thenExp, otherwise if cond is false evaluate elseExp. If the result is true then branch to tt, otherwise branch to ff.

Specified by:
unCx in class Exp.Cx
Parameters:
tt - label to branch to on true
ff - label to branch to on false
Returns:
the tree code to evaluate the expression and effect the transfer of control.