Class CaseNode
java.lang.Object
org.checkerframework.dataflow.cfg.node.Node
org.checkerframework.dataflow.cfg.node.CaseNode
- All Implemented Interfaces:
org.plumelib.util.UniqueId
A node for a case in a switch statement. Although a case has no abstract value, it can imply
facts about the abstract values of its operands.
case constant:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe case expressions to match the switch expression against: the operands of (possibly multiple) case labels.The guard (the expression in thewhenclause) for this case.protected final AssignmentNodeThe Node for the assignment of the switch selector expression to a synthetic local variable.protected final CaseTreeThe tree for this node. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R,P> R accept(NodeVisitor<R, P> visitor, P p) Accept method of the visitor pattern.booleanGets the nodes corresponding to the case expressions.getGuard()Gets the node for the guard (the expression in thewhenclause).The Node for the assignment of the switch selector expression to a synthetic local variable.getTree()Returns theTreein the abstract syntax tree, ornullif no corresponding tree exists.inthashCode()toString()Methods inherited from class org.checkerframework.dataflow.cfg.node.Node
getBlock, getInSource, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setBlock, setInSource, setLValue, toStringDebugMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.plumelib.util.UniqueId
getClassAndUid
-
Field Details
-
tree
The tree for this node. -
selectorExprAssignment
The Node for the assignment of the switch selector expression to a synthetic local variable. -
caseExprs
The case expressions to match the switch expression against: the operands of (possibly multiple) case labels. -
guard
The guard (the expression in thewhenclause) for this case.
-
-
Constructor Details
-
CaseNode
public CaseNode(CaseTree tree, AssignmentNode selectorExprAssignment, List<Node> caseExprs, @Nullable Node guard, Types types) Create a new CaseNode.- Parameters:
tree- the tree for this nodeselectorExprAssignment- the Node for the assignment of the switch selector expression to a synthetic local variablecaseExprs- the case expression(s) to match the switch expression againstguard- the guard expression or nulltypes- a factory of utility methods for operating on types
-
-
Method Details
-
getSwitchOperand
The Node for the assignment of the switch selector expression to a synthetic local variable. This is used to refine the type of the switch selector expression in a case block.- Returns:
- the assignment of the switch selector expression to a synthetic local variable
-
getCaseOperands
Gets the nodes corresponding to the case expressions. There can be multiple expressions since Java 12.- Returns:
- the nodes corresponding to the (potentially multiple) case expressions
-
getGuard
Gets the node for the guard (the expression in thewhenclause).- Returns:
- the node for the guard
-
getTree
Description copied from class:NodeReturns theTreein the abstract syntax tree, ornullif no corresponding tree exists. For instance, this is the case for anImplicitThisNode. -
accept
Description copied from class:NodeAccept method of the visitor pattern. -
toString
-
equals
-
hashCode
public int hashCode() -
getOperands
Description copied from class:Node- Specified by:
getOperandsin classNode- Returns:
- a collection containing all of the operand
Nodes of thisNode
-