public class AssignmentNode extends Node
variable = expression variable += expression expression . field = expression expression [ index ] = expressionWe allow assignments without corresponding AST
Tree
s.
Some desugarings create additional assignments to synthetic local variables. Such assignment nodes are marked as synthetic to allow special handling in transfer functions.
String concatenation compound assignments are desugared to an assignment and a string concatenation.
Numeric compound assignments are desugared to an assignment and a numeric operation.
Modifier and Type | Field and Description |
---|---|
protected Node |
lhs
The node for the LHS of the assignment tree.
|
protected Node |
rhs
The node for the RHS of the assignment tree.
|
protected boolean |
synthetic
Whether the assignment node is synthetic
|
protected Tree |
tree
The underlying assignment tree.
|
Constructor and Description |
---|
AssignmentNode(Tree tree,
Node target,
Node expression)
Create a (non-synthetic) AssignmentNode.
|
AssignmentNode(Tree tree,
Node target,
Node expression,
boolean synthetic)
Create an AssignmentNode.
|
Modifier and Type | Method and Description |
---|---|
<R,P> R |
accept(NodeVisitor<R,P> visitor,
P p)
Accept method of the visitor pattern.
|
boolean |
equals(@Nullable Object obj) |
Node |
getExpression()
Returns the right-hand-side of the assignment.
|
Collection<Node> |
getOperands()
|
Node |
getTarget()
Returns the left-hand-side of the assignment.
|
Tree |
getTree()
Returns the
Tree in the abstract syntax tree, or null if no corresponding
tree exists. |
int |
hashCode() |
boolean |
isSynthetic()
Check if the assignment node is synthetic, e.g.
|
String |
toString() |
getBlock, getInSource, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setBlock, setInSource, setLValue, toStringDebug
protected final Tree tree
protected final Node lhs
protected final Node rhs
protected final boolean synthetic
public AssignmentNode(Tree tree, Node target, Node expression)
tree
- the AssignmentTree
corresponding to the AssignmentNode
target
- the lhs of tree
expression
- the rhs of tree
public AssignmentNode(Tree tree, Node target, Node expression, boolean synthetic)
tree
- the AssignmentTree
corresponding to the AssignmentNode
target
- the lhs of tree
expression
- the rhs of tree
synthetic
- whether the assignment node is synthetic@Pure public Node getTarget()
@Pure public Node getExpression()
@Pure public Tree getTree()
Node
Tree
in the abstract syntax tree, or null
if no corresponding
tree exists. For instance, this is the case for an ImplicitThisNode
.@Pure public boolean isSynthetic()
public <R,P> R accept(NodeVisitor<R,P> visitor, P p)
Node
@Pure public Collection<Node> getOperands()
Node
getOperands
in class Node
Node
s of this Node