public final class ForNode extends LoopNode
| Modifier and Type | Field and Description |
|---|---|
static int |
IS_FOR_AWAIT_OF
Is this a for await of loop?
|
static int |
IS_FOR_EACH
Is this a normal for each in loop?
|
static int |
IS_FOR_IN
Is this a normal for in loop?
|
static int |
IS_FOR_OF
Is this a for of loop?
|
static int |
PER_ITERATION_SCOPE
Does this loop need a per-iteration scope because its init contain a LET declaration?
|
body, controlFlowEscapes, test| Constructor and Description |
|---|
ForNode(int lineNumber,
long token,
int finish,
Block body,
int flags,
Expression init,
JoinPredecessorExpression test,
JoinPredecessorExpression modify)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Node |
accept(LexicalContext lc,
NodeVisitor<? extends LexicalContext> visitor)
Accept function for the node given a lexical context.
|
<R> R |
accept(LexicalContext lc,
TranslatorNodeVisitor<? extends LexicalContext,R> visitor) |
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.
|
Block |
getBody()
Get the body for this for node
|
Expression |
getInit()
Get the initialization expression for this for loop
|
Symbol |
getIterator()
If this is a for in or for each construct, there is an iterator symbol
|
JoinPredecessorExpression |
getModify()
Get the modification expression for this ForNode
|
boolean |
hasGoto()
|
boolean |
hasPerIterationScope()
Does this loop have a LET declaration and hence require a per-iteration scope?
|
boolean |
isBreakableWithoutLabel()
Check whether this can be broken out from without using a label, e.g.
|
boolean |
isForAwaitOf()
Is this an ECMAScript 8 for-await-of construct.
|
boolean |
isForEach()
Is this a (non-standard) for each construct, known from e.g.
|
boolean |
isForIn()
Is this a for in construct rather than a standard init;condition;modification one
|
boolean |
isForInOrOf()
Is this a for-in or for-of statement?
|
boolean |
isForOf()
Is this an ECMAScript 6 for of construct.
|
boolean |
mustEnter()
Conservative check: does this loop have to be entered?
|
ForNode |
setBody(LexicalContext lc,
Block body) |
ForNode |
setControlFlowEscapes(LexicalContext lc,
boolean controlFlowEscapes)
Set the control flow escapes flag for this node.
|
ForNode |
setInit(LexicalContext lc,
Expression init)
Reset the initialization expression for this for loop
|
void |
setIterator(Symbol iterator)
Assign an iterator symbol to this ForNode.
|
ForNode |
setModify(LexicalContext lc,
JoinPredecessorExpression modify)
Reset the modification expression for this ForNode
|
ForNode |
setTest(LexicalContext lc,
JoinPredecessorExpression test)
Set the test for this for node
|
void |
toString(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 value
|
getTest, isCompletionValueNeverEmpty, isLoop, isTerminalgetLineNumber, hasTerminalFlagsclone, equals, getFinish, getSourceOrder, getStart, getToken, hashCode, isAssignment, isTokenType, tokenType, toString, toStringaccept, acceptpublic static final int IS_FOR_IN
public static final int IS_FOR_EACH
public static final int PER_ITERATION_SCOPE
public static final int IS_FOR_OF
public static final int IS_FOR_AWAIT_OF
public ForNode(int lineNumber,
long token,
int finish,
Block body,
int flags,
Expression init,
JoinPredecessorExpression test,
JoinPredecessorExpression modify)
lineNumber - The line number of headertoken - The for tokenfinish - The last character of the for nodebody - The body of the for nodeflags - The flagsinit - The initial expressiontest - The test expressionmodify - The modify expressionpublic Node accept(LexicalContext lc, NodeVisitor<? extends LexicalContext> visitor)
LexicalContextNodelc - lexical contextvisitor - node visitorpublic <R> R accept(LexicalContext lc, TranslatorNodeVisitor<? extends LexicalContext,R> visitor)
public void toString(StringBuilder sb, boolean printTypes)
Nodepublic boolean hasGoto()
Statementpublic boolean mustEnter()
LoopNodepublic Expression getInit()
public ForNode setInit(LexicalContext lc, Expression init)
lc - lexical contextinit - new initialization expressionpublic boolean isForIn()
public boolean isForEach()
public boolean isForOf()
public boolean isForAwaitOf()
public boolean isForInOrOf()
public Symbol getIterator()
public void setIterator(Symbol iterator)
iterator - the iterator symbolpublic JoinPredecessorExpression getModify()
public ForNode setModify(LexicalContext lc, JoinPredecessorExpression modify)
lc - lexical contextmodify - new modification expressionpublic ForNode setTest(LexicalContext lc, JoinPredecessorExpression test)
LoopNodepublic Block getBody()
LoopNodepublic ForNode setBody(LexicalContext lc, Block body)
public ForNode setControlFlowEscapes(LexicalContext lc, boolean controlFlowEscapes)
LoopNodesetControlFlowEscapes in class LoopNodelc - lexical contextcontrolFlowEscapes - control flow escapes valuepublic boolean hasPerIterationScope()
LoopNodehasPerIterationScope in class LoopNodepublic boolean isBreakableWithoutLabel()
isBreakableWithoutLabel in interface BreakableNodepublic final Node accept(NodeVisitor<? extends LexicalContext> visitor)
Nodeaccept in interface LexicalContextNodeaccept in class Nodevisitor - Node visitor.public final <R> R accept(TranslatorNodeVisitor<? extends LexicalContext,R> visitor)
Nodeaccept in interface LexicalContextNodeaccept in class Nodevisitor - Node visitor.