Package com.google.javascript.jscomp
Class ControlFlowGraph<N>
java.lang.Object
com.google.javascript.jscomp.graph.Graph<N,ControlFlowGraph.Branch>
com.google.javascript.jscomp.graph.DiGraph<N,ControlFlowGraph.Branch>
com.google.javascript.jscomp.graph.LinkedDirectedGraph<N,ControlFlowGraph.Branch>
com.google.javascript.jscomp.ControlFlowGraph<N>
- Type Parameters:
N
- The instruction type of the control flow graph.
- All Implemented Interfaces:
AdjacencyGraph<N,
,ControlFlowGraph.Branch> GraphvizGraph
Control flow graph.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Abstract callback to visit a control flow graph node without going into subtrees of the node that are also represented by other control flow graph nodes.static enum
The edge object for the control flow graph.Nested classes/interfaces inherited from class com.google.javascript.jscomp.graph.LinkedDirectedGraph
LinkedDirectedGraph.LinkedDiGraphEdge<N,
E>, LinkedDirectedGraph.LinkedDiGraphNode<N, E> Nested classes/interfaces inherited from class com.google.javascript.jscomp.graph.DiGraph
DiGraph.DiGraphEdge<N,
E>, DiGraph.DiGraphNode<N, E> Nested classes/interfaces inherited from class com.google.javascript.jscomp.graph.Graph
Graph.GraphEdge<N,
E> Nested classes/interfaces inherited from interface com.google.javascript.jscomp.graph.GraphvizGraph
GraphvizGraph.GraphvizEdge, GraphvizGraph.GraphvizNode
-
Field Summary
Fields inherited from class com.google.javascript.jscomp.graph.LinkedDirectedGraph
nodes
-
Method Summary
Modifier and TypeMethodDescriptiongetEntry()
Gets the entry point of the control flow graph.Gets the implicit return node.getOptionalNodeComparator
(boolean isForward) Gets a comparator for the nodes.static boolean
boolean
Checks whether node is the implicit return.toString()
Methods inherited from class com.google.javascript.jscomp.graph.LinkedDirectedGraph
connect, connect, connectIfNotConnectedInDirection, create, createNode, createWithoutAnnotations, disconnect, disconnectInDirection, getDirectedPredNodes, getDirectedPredNodes, getDirectedSuccNodes, getDirectedSuccNodes, getEdges, getEdges, getEdgesInDirection, getFirstEdge, getGraphvizEdges, getGraphvizNodes, getInEdges, getName, getNeighborNodes, getNode, getNodeCount, getNodeDegree, getNodes, getOutEdges, isConnectedInDirection, isConnectedInDirection, isConnectedInDirection, isDirected, newSubGraph
Methods inherited from class com.google.javascript.jscomp.graph.DiGraph
isConnected, isConnected
Methods inherited from class com.google.javascript.jscomp.graph.Graph
clearEdgeAnnotations, clearNodeAnnotations, connectIfNotFound, getWeight, hasNode, popEdgeAnnotations, popNodeAnnotations, pushEdgeAnnotations, pushNodeAnnotations
-
Method Details
-
getImplicitReturn
Gets the implicit return node.- Returns:
- Return node.
-
getEntry
Gets the entry point of the control flow graph. In general, this should be the beginning of the global script or beginning of a function.- Returns:
- The entry point.
-
isImplicitReturn
Checks whether node is the implicit return.- Parameters:
node
- Node.- Returns:
- True if the node is the implicit return.
-
getOptionalNodeComparator
public Comparator<DiGraph.DiGraphNode<N,ControlFlowGraph.Branch>> getOptionalNodeComparator(boolean isForward) Gets a comparator for the nodes. The default implementation returnsnull
. SeegetOptionalNodeComparator(boolean)
.- Parameters:
isForward
- Whether the comparator sorts the nodes in the direction of the flow.- Returns:
- a comparator or null (in particular, if not overridden)
-
isEnteringNewCfgNode
- Returns:
- True if n should be represented by a new CFG node in the control flow graph.
-
toString
-