public abstract class Node extends Object
The following invariants hold:
block == null || block instanceof RegularBlock || block instanceof ExceptionBlock block instanceof RegularBlock ==> block.getContents().contains(this) block instanceof ExceptionBlock ==> block.getNode() == this block == null <==> "This object represents a parameter of the method."
type != null tree != null ==> node.getType() == InternalUtils.typeOf(node.getTree())
Modifier and Type | Field and Description |
---|---|
protected @Nullable AssignmentContext |
assignmentContext
The assignment context of this node.
|
protected @Nullable Block |
block
The basic block this node belongs to (see invariant about this field
above).
|
protected boolean |
inSource
Does this node represent a tree that appears in the source code (true)
or one that the CFG builder added while desugaring (false).
|
protected boolean |
lvalue
Is this node an l-value?
|
protected TypeMirror |
type
The type of this node.
|
Constructor and Description |
---|
Node(TypeMirror type) |
Modifier and Type | Method and Description |
---|---|
abstract <R,P> R |
accept(NodeVisitor<R,P> visitor,
P p)
Accept method of the visitor pattern
|
AssignmentContext |
getAssignmentContext() |
@Nullable Block |
getBlock() |
boolean |
getInSource() |
abstract Collection<Node> |
getOperands() |
Collection<Node> |
getTransitiveOperands() |
abstract @Nullable Tree |
getTree()
Returns the
Tree in the abstract syntax tree, or
null if no corresponding tree exists. |
TypeMirror |
getType()
Returns a
TypeMirror representing the type of a Node A
Node will always have a type even when it has no Tree . |
boolean |
isLValue() |
void |
setAssignmentContext(AssignmentContext assignmentContext) |
void |
setBlock(Block b)
Set the basic block this node belongs to.
|
void |
setInSource(boolean inSrc) |
void |
setLValue()
Make this node an l-value.
|
protected @Nullable Block block
protected boolean lvalue
protected @Nullable AssignmentContext assignmentContext
AssignmentContext
.protected boolean inSource
protected final TypeMirror type
Node
s with Tree
s, this type is
the type of the Tree
. Otherwise, it is the type is set by the
CFGBuilder
.public Node(TypeMirror type)
public @Nullable Block getBlock()
null
if it
represents the parameter of a method).public void setBlock(Block b)
public abstract @Nullable Tree getTree()
Tree
in the abstract syntax tree, or
null
if no corresponding tree exists. For instance, this is
the case for an ImplicitThisLiteralNode
.Tree
or null
.public TypeMirror getType()
TypeMirror
representing the type of a Node
A
Node
will always have a type even when it has no Tree
.TypeMirror
representing the type of this Node
.public abstract <R,P> R accept(NodeVisitor<R,P> visitor, P p)
R
- Result type of the operation.P
- Parameter type.visitor
- The visitor to be applied to this node.p
- The parameter for this operation.public boolean isLValue()
public void setLValue()
public boolean getInSource()
public void setInSource(boolean inSrc)
public AssignmentContext getAssignmentContext()
public void setAssignmentContext(AssignmentContext assignmentContext)
public abstract Collection<Node> getOperands()
public Collection<Node> getTransitiveOperands()