public final class SwitchNode extends Statement
| Constructor and Description |
|---|
SwitchNode(int lineNumber,
long token,
int finish,
Expression expression,
List<CaseNode> cases,
int defaultCaseIndex)
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.
|
List<CaseNode> |
getCases()
Get the cases in this switch
|
CaseNode |
getDefaultCase()
Return the case node that is default case
|
Expression |
getExpression()
Return the expression to switch on
|
Symbol |
getTag()
Get the tag symbol for this switch.
|
boolean |
hasDefaultCase() |
boolean |
isBreakableWithoutLabel()
Check whether this can be broken out from without using a label, e.g.
|
boolean |
isCompletionValueNeverEmpty() |
boolean |
isTerminal()
Is this a terminal statement, i.e.
|
SwitchNode |
setExpression(LexicalContext lc,
Expression expression)
Set or reset the expression to switch on
|
void |
setTag(Symbol tag)
Set the tag symbol for this switch.
|
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
|
getLineNumber, hasGoto, hasTerminalFlagsclone, equals, getFinish, getSourceOrder, getStart, getToken, hashCode, isAssignment, isLoop, isTokenType, tokenType, toString, toStringaccept, acceptpublic SwitchNode(int lineNumber,
long token,
int finish,
Expression expression,
List<CaseNode> cases,
int defaultCaseIndex)
lineNumber - lineNumbertoken - tokenfinish - finishexpression - switch expressioncases - casesdefaultCaseIndex - the default case index; -1 if none, otherwise has to be present in
cases listpublic boolean isTerminal()
StatementisTerminal in interface TerminalisTerminal in class Statementpublic 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 printType)
Nodepublic CaseNode getDefaultCase()
public List<CaseNode> getCases()
public Expression getExpression()
public SwitchNode setExpression(LexicalContext lc, Expression expression)
lc - lexical contextexpression - switch expressionpublic Symbol getTag()
public void setTag(Symbol tag)
tag - a symbolpublic boolean hasDefaultCase()
public boolean isCompletionValueNeverEmpty()
isCompletionValueNeverEmpty in class Statementemptypublic 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.