Class IfNode
java.lang.Object
com.oracle.js.parser.ir.Node
com.oracle.js.parser.ir.Statement
com.oracle.js.parser.ir.IfNode
IR representation for an IF statement.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionIfNode(int lineNumber, long token, int finish, Expression test, Block pass, Block fail) Constructor -
Method Summary
Modifier and TypeMethodDescriptionaccept(NodeVisitor<? extends LexicalContext> visitor) Provides a means to navigate the IR.<R> Raccept(TranslatorNodeVisitor<? extends LexicalContext, R> visitor) Provides a means to navigate the IR.getFail()Get the else block of this IfNodegetPass()Get the then block for this IfNodegetTest()Get the test expression for this IfNodebooleanbooleanIs this a terminal statement, i.e.setTest(Expression test) Reset the test expression for this IfNodevoidtoString(StringBuilder sb, boolean printTypes) 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 valueMethods inherited from class com.oracle.js.parser.ir.Statement
getLineNumber, hasGoto, hasTerminalFlagsMethods inherited from class com.oracle.js.parser.ir.Node
clone, equals, getFinish, getSourceOrder, getStart, getToken, hashCode, isAssignment, isLoop, isTokenType, tokenType, toString, toString
-
Constructor Details
-
IfNode
Constructor- Parameters:
lineNumber- line numbertoken- tokenfinish- finishtest- testpass- block to execute when test passesfail- block to execute when test fails or null
-
-
Method Details
-
isTerminal
public boolean isTerminal()Description copied from class:StatementIs this a terminal statement, i.e. does it end control flow like a throw or return?- Specified by:
isTerminalin interfaceTerminal- Overrides:
isTerminalin classStatement- Returns:
- true if this node statement is terminal
-
accept
Description copied from class:NodeProvides a means to navigate the IR. -
accept
Description copied from class:NodeProvides a means to navigate the IR. -
toString
Description copied from class:NodePrint 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 -
getFail
Get the else block of this IfNode- Returns:
- the else block, or null if none exists
-
getPass
-
getTest
-
setTest
Reset the test expression for this IfNode- Parameters:
test- a new test expression- Returns:
- new or same IfNode
-
isCompletionValueNeverEmpty
public boolean isCompletionValueNeverEmpty()- Overrides:
isCompletionValueNeverEmptyin classStatement- Returns:
- true if the completion value of this statement is never the value
empty
-