Class WhileNode
java.lang.Object
com.oracle.js.parser.ir.Node
com.oracle.js.parser.ir.Statement
com.oracle.js.parser.ir.LoopNode
com.oracle.js.parser.ir.WhileNode
- All Implemented Interfaces:
BreakableNode,LexicalContextNode,Terminal,Cloneable
IR representation for a while statement. This is the superclass of all loop nodes
-
Field Summary
Fields inherited from class com.oracle.js.parser.ir.LoopNode
body, controlFlowEscapes, test -
Constructor Summary
ConstructorsConstructorDescriptionWhileNode(int lineNumber, long token, int finish, boolean isDoWhile, JoinPredecessorExpression test, Block body) Constructor -
Method Summary
Modifier and TypeMethodDescriptionaccept(LexicalContext lc, NodeVisitor<? extends LexicalContext> visitor) Accept function for the node given a lexical context.<R> Raccept(LexicalContext lc, TranslatorNodeVisitor<? extends LexicalContext, R> visitor) final Nodeaccept(NodeVisitor<? extends LexicalContext> visitor) Provides a means to navigate the IR.final <R> Raccept(TranslatorNodeVisitor<? extends LexicalContext, R> visitor) Provides a means to navigate the IR.getBody()Get the body for this for nodebooleanhasGoto()booleanDoes this loop have a LET declaration and hence require a per-iteration scope?booleanCheck whether this can be broken out from without using a label, e.g.booleanCheck if this is a do while loop or a normal while loopbooleanConservative check: does this loop have to be entered?setBody(LexicalContext lc, Block body) setControlFlowEscapes(LexicalContext lc, boolean controlFlowEscapes) Set the control flow escapes flag for this node.setTest(LexicalContext lc, JoinPredecessorExpression test) Set the test for this for nodevoidtoString(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 valueMethods inherited from class com.oracle.js.parser.ir.LoopNode
getTest, isCompletionValueNeverEmpty, isLoop, isTerminalMethods inherited from class com.oracle.js.parser.ir.Statement
getLineNumber, hasTerminalFlagsMethods inherited from class com.oracle.js.parser.ir.Node
clone, equals, getFinish, getSourceOrder, getStart, getToken, hashCode, isAssignment, isTokenType, tokenType, toString, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.js.parser.ir.LexicalContextNode
accept, accept
-
Constructor Details
-
WhileNode
public WhileNode(int lineNumber, long token, int finish, boolean isDoWhile, JoinPredecessorExpression test, Block body) Constructor- Parameters:
lineNumber- line numbertoken- tokenfinish- finishisDoWhile- is this a do while loop?test- test expressionbody- body of the while loop
-
-
Method Details
-
hasGoto
-
accept
Description copied from interface:LexicalContextNodeAccept function for the node given a lexical context. It must be prepared to replace itself if present in the lexical context- Parameters:
lc- lexical contextvisitor- node visitor- Returns:
- new node or same node depending on state change
-
accept
-
setTest
Description copied from class:LoopNodeSet the test for this for node -
getBody
-
setBody
-
setControlFlowEscapes
Description copied from class:LoopNodeSet the control flow escapes flag for this node.- Specified by:
setControlFlowEscapesin classLoopNode- Parameters:
lc- lexical contextcontrolFlowEscapes- control flow escapes value- Returns:
- new loop node if changed otherwise the same
-
isDoWhile
public boolean isDoWhile()Check if this is a do while loop or a normal while loop- Returns:
- true if do while
-
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 -
mustEnter
-
hasPerIterationScope
public boolean hasPerIterationScope()Description copied from class:LoopNodeDoes this loop have a LET declaration and hence require a per-iteration scope?- Specified by:
hasPerIterationScopein classLoopNode- Returns:
- true if a per-iteration scope is required.
-
isBreakableWithoutLabel
public boolean isBreakableWithoutLabel()Check whether this can be broken out from without using a label, e.g. everything but Blocks, basically- Specified by:
isBreakableWithoutLabelin interfaceBreakableNode- Returns:
- true if breakable without label
-
accept
Description copied from class:NodeProvides a means to navigate the IR.- Specified by:
acceptin interfaceLexicalContextNode- Specified by:
acceptin classNode- Parameters:
visitor- Node visitor.- Returns:
- node the node or its replacement after visitation, null if no further visitations are required
-
accept
Description copied from class:NodeProvides a means to navigate the IR.- Specified by:
acceptin interfaceLexicalContextNode- Specified by:
acceptin classNode- Parameters:
visitor- Node visitor.- Returns:
- node the node or its replacement after visitation, null if no further visitations are required
-