public final class Block extends ExpressionStatement implements Scope
| Modifier and Type | Method and Description |
|---|---|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
Block |
add(java.lang.Object statement) |
void |
addStatement(GoloStatement statement) |
static Block |
emptyBlock() |
java.util.Optional<ReferenceTable> |
getLocalReferenceTable() |
ReferenceTable |
getReferenceTable() |
java.util.List<GoloStatement> |
getStatements() |
boolean |
hasOnlyReturn() |
boolean |
hasReturn() |
void |
internReferenceTable() |
boolean |
isEmpty() |
void |
merge(Block other) |
static Block |
of(java.lang.Object block) |
Block |
ofAST(GoloASTNode n) |
void |
prependStatement(GoloStatement statement) |
Block |
ref(java.lang.Object referenceTable) |
void |
relink(ReferenceTable table)
Make the given table a parent of this scope.
|
void |
relinkTopLevel(ReferenceTable table)
Make the given table the top-level parent of this scope.
|
protected void |
replaceElement(GoloElement original,
GoloElement newElement)
Replace a child.
|
void |
setReferenceTable(ReferenceTable referenceTable) |
int |
size() |
java.lang.String |
toString() |
void |
walk(GoloIrVisitor visitor)
Walk the visitor through this node children.
|
cantConvert, cantReplace, cantReplace, doesNotContain, getASTNode, getDocumentation, getParentNode, getPositionInSourceCode, hasASTNode, makeParentOf, replaceInParentBy, setASTNode, setParentNodepublic static Block emptyBlock()
public Block ofAST(GoloASTNode n)
ofAST in class GoloElementpublic ReferenceTable getReferenceTable()
public java.util.Optional<ReferenceTable> getLocalReferenceTable()
getLocalReferenceTable in class GoloElementpublic void setReferenceTable(ReferenceTable referenceTable)
public void internReferenceTable()
public java.util.List<GoloStatement> getStatements()
public void addStatement(GoloStatement statement)
public void prependStatement(GoloStatement statement)
public boolean hasReturn()
public int size()
public boolean hasOnlyReturn()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isEmpty()
public void relink(ReferenceTable table)
Scopepublic void relinkTopLevel(ReferenceTable table)
ScopeGo up in the hierarchy of parent scope, and set the root to the given table.
relinkTopLevel in interface Scopepublic void accept(GoloIrVisitor visitor)
GoloElement
This method should only call the visitor visitXXXX method.
The children of this node will be visited by the
GoloElement.walk(GoloIrVisitor) method.
accept in class GoloElementpublic void walk(GoloIrVisitor visitor)
GoloElementwalk in class GoloElementprotected void replaceElement(GoloElement original, GoloElement newElement)
GoloElement
Replace original with newElement if original is a child of this node
and type matches.
replaceElement in class GoloElementoriginal - the original value to replace. Must be a child of this nodenewElement - the element to replace with. Type must match.GoloElement.cantReplace(),
GoloElement.cantReplace(GoloElement, GoloElement),
GoloElement.doesNotContain(GoloElement),
GoloElement.cantConvert(String, Object)