Class ExitChecker

  extended by polyglot.visit.NodeVisitor
      extended by polyglot.visit.HaltingVisitor
          extended by polyglot.visit.ErrorHandlingVisitor
              extended by polyglot.visit.DataFlow
                  extended by polyglot.visit.ExitChecker
All Implemented Interfaces:
java.lang.Cloneable, Copy

public class ExitChecker
extends DataFlow

Visitor which checks that all (terminating) paths through a method must return.

Nested Class Summary
protected static class ExitChecker.DataFlowItem
Nested classes/interfaces inherited from class polyglot.visit.DataFlow
DataFlow.BoolItem, DataFlow.ConditionNavigator, DataFlow.FlowGraphSource, DataFlow.Item
Field Summary
protected  CodeDecl code
Fields inherited from class polyglot.visit.DataFlow
dataflowOnEntry, flowCounter, flowgraphStack, forward
Fields inherited from class polyglot.visit.ErrorHandlingVisitor
error, job, nf, ts
Constructor Summary
ExitChecker(Job job, TypeSystem ts, NodeFactory nf)
Method Summary
 void check(FlowGraph graph, Term n, DataFlow.Item inItem, java.util.Map outItems)
          Check that the term n satisfies whatever properties this dataflow is checking for.
 DataFlow.Item confluence(java.util.List inItems, Term node, FlowGraph graph)
          The confluence operator for many flows.
 DataFlow.Item createInitialItem(FlowGraph graph, Term node)
          Create an initial Item for the term node.
 java.util.Map flow(DataFlow.Item in, FlowGraph graph, Term n, java.util.Set succEdgeKeys)
          Produce new Items as appropriate for the Term n and the input Item in.
protected  FlowGraph initGraph(CodeDecl code, Term root)
          Initialise the FlowGraph to be used in the dataflow analysis.
Methods inherited from class polyglot.visit.DataFlow
confluence, constructItemsFromCondition, createCFGBuilder, currentFlowGraph, dataflow, dataflow, dumpFlowGraph, enterCall, filterItems, filterItemsExceptionSubclass, filterItemsNonError, filterItemsNonException, findSCCs, flow, flow, flowBooleanConditions, flowToBooleanFlow, hasTrueFalseBranches, itemsToMap, itemToMap, leave, leaveCall, post, safeConfluence, safeConfluence, safeConfluence
Methods inherited from class polyglot.visit.ErrorHandlingVisitor
begin, catchErrors, enter, enterCall, enterError, errorQueue, job, leaveCall, nodeFactory, typeSystem
Methods inherited from class polyglot.visit.HaltingVisitor
bypass, bypass, bypassChildren, copy, override, visitChildren
Methods inherited from class polyglot.visit.NodeVisitor
enter, finish, finish, leave, override, toString, visitEdge
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


protected CodeDecl code
Constructor Detail


public ExitChecker(Job job,
                   TypeSystem ts,
                   NodeFactory nf)
Method Detail


protected FlowGraph initGraph(CodeDecl code,
                              Term root)
Description copied from class: DataFlow
Initialise the FlowGraph to be used in the dataflow analysis.

initGraph in class DataFlow
null if no dataflow analysis should be performed for this code declaration; otherwise, an apropriately initialized FlowGraph.


public DataFlow.Item createInitialItem(FlowGraph graph,
                                       Term node)
Description copied from class: DataFlow
Create an initial Item for the term node. This is generally how the Item that will be given to the start node of a graph is created, although this method may also be called for other (non-start) nodes.

Specified by:
createInitialItem in class DataFlow
a (possibly null) Item.


public java.util.Map flow(DataFlow.Item in,
                          FlowGraph graph,
                          Term n,
                          java.util.Set succEdgeKeys)
Description copied from class: DataFlow
Produce new Items as appropriate for the Term n and the input Item in.

flow in class DataFlow
in - the Item flowing into the node. Note that if the Term n has many flows going into it, the Item in may be the result of a call to confluence(List, List, Term)
graph - the FlowGraph which the dataflow is operating on
n - the Term which this method must calculate the flow for.
succEdgeKeys - a set of FlowGraph.EdgeKeys, being all the EdgeKeys of the edges leaving this node. The returned Map must have mappings for all objects in this set.
a Map from FlowGraph.EdgeKeys to Items. The map must have entries for all EdgeKeys in edgeKeys.


public DataFlow.Item confluence(java.util.List inItems,
                                Term node,
                                FlowGraph graph)
Description copied from class: DataFlow
The confluence operator for many flows. This method produces a single Item from a List of Items, for the confluence just before flow enters node.

Specified by:
confluence in class DataFlow
inItems - List of Items that flow into node. this method will only be called if the list has at least 2 elements.
node - Term for which the items are flowing into.
a non-null Item.


public void check(FlowGraph graph,
                  Term n,
                  DataFlow.Item inItem,
                  java.util.Map outItems)
           throws SemanticException
Description copied from class: DataFlow
Check that the term n satisfies whatever properties this dataflow is checking for. This method is called for each term in a code declaration block after the dataflow for that block of code has been performed.

Specified by:
check in class DataFlow