public final class TernaryNode extends Expression
?:. Note that for control-flow calculation
reasons its branch expressions (but not its test expression) are always wrapped in instances of
JoinPredecessorExpression.| Constructor and Description |
|---|
TernaryNode(long token,
Expression test,
JoinPredecessorExpression trueExpr,
JoinPredecessorExpression falseExpr)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Node |
accept(NodeVisitor<? extends LexicalContext> visitor)
Provides a means to navigate the IR.
|
<R> R |
accept(TranslatorNodeVisitor<? extends LexicalContext,R> visitor)
Provides a means to navigate the IR.
|
JoinPredecessorExpression |
getFalseExpression()
Get the false expression for this ternary expression, i.e.
|
Expression |
getTest()
Get the test expression for this ternary expression, i.e.
|
JoinPredecessorExpression |
getTrueExpression()
Get the true expression for this ternary expression, i.e.
|
TernaryNode |
setFalseExpression(JoinPredecessorExpression falseExpr)
Set the false expression for this node
|
TernaryNode |
setTest(Expression test)
Set the test expression for this node
|
TernaryNode |
setTrueExpression(JoinPredecessorExpression trueExpr)
Set the true expression for this node
|
void |
toString(StringBuilder sb,
boolean printType)
Print logic that decides whether to show the optimistic type or not - for example it should
not be printed after just parse, when it hasn't been computed, or has been set to a trivially
provable value
|
getFinish, getFinishWithoutParens, getStart, getStartWithoutParens, isAlwaysFalse, isAlwaysTrue, isParenthesized, isSelfModifying, makeParenthesizedclone, equals, getSourceOrder, getToken, hashCode, isAssignment, isLoop, isTokenType, tokenType, toString, toStringpublic TernaryNode(long token,
Expression test,
JoinPredecessorExpression trueExpr,
JoinPredecessorExpression falseExpr)
token - tokentest - test expressiontrueExpr - expression evaluated when test evaluates to truefalseExpr - expression evaluated when test evaluates to truepublic Node accept(NodeVisitor<? extends LexicalContext> visitor)
Nodepublic <R> R accept(TranslatorNodeVisitor<? extends LexicalContext,R> visitor)
Nodepublic void toString(StringBuilder sb, boolean printType)
Nodepublic Expression getTest()
public JoinPredecessorExpression getTrueExpression()
public JoinPredecessorExpression getFalseExpression()
public TernaryNode setTest(Expression test)
test - new test expressionpublic TernaryNode setTrueExpression(JoinPredecessorExpression trueExpr)
trueExpr - new true expressionpublic TernaryNode setFalseExpression(JoinPredecessorExpression falseExpr)
falseExpr - new false expression