|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object polyglot.visit.NodeVisitor polyglot.visit.HaltingVisitor polyglot.visit.ErrorHandlingVisitor polyglot.visit.ExceptionChecker
public class ExceptionChecker
Visitor which checks if exceptions are caught or declared properly.
Field Summary | |
---|---|
protected java.util.Map |
exceptionPositions
|
protected ExceptionChecker |
outer
|
Fields inherited from class polyglot.visit.ErrorHandlingVisitor |
---|
error, job, nf, ts |
Constructor Summary | |
---|---|
ExceptionChecker(Job job,
TypeSystem ts,
NodeFactory nf)
|
Method Summary | |
---|---|
protected NodeVisitor |
enterCall(Node n)
This method is called when we are to perform a "normal" traversal of a subtree rooted at n . |
protected NodeVisitor |
enterError(Node n)
This method determines what should be returned by enter()
should its call to enterCall() throw a
SemanticException . |
Position |
exceptionPosition(Type t)
Method to determine the position at which a particular exception is thrown |
protected Node |
leaveCall(Node old,
Node n,
NodeVisitor v)
Here, we pop the stack frame that we pushed in enter and agregate the exceptions. |
ExceptionChecker |
pop()
|
ExceptionChecker |
push()
|
ExceptionChecker |
pushNew()
|
void |
throwsException(Type t,
Position pos)
The ast nodes will use this callback to notify us that they throw an exception of type t. |
SubtypeSet |
throwsSet()
Method to allow the throws clause and method body to inspect and modify the throwsSet. |
Methods inherited from class polyglot.visit.ErrorHandlingVisitor |
---|
begin, catchErrors, enter, enterCall, errorQueue, job, leave, 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 ExceptionChecker outer
protected java.util.Map exceptionPositions
Constructor Detail |
---|
public ExceptionChecker(Job job, TypeSystem ts, NodeFactory nf)
Method Detail |
---|
public ExceptionChecker pushNew()
public ExceptionChecker push()
public ExceptionChecker pop()
protected NodeVisitor enterCall(Node n) throws SemanticException
n
. At every node, we will push a
stack frame. Each child node will add the exceptions that it throws
to this stack frame. For most nodes ( excdeption for the try / catch)
will just aggregate the stack frames.
enterCall
in class ErrorHandlingVisitor
n
- The root of the subtree to be traversed.
NodeVisitor
which should be used to visit the
children of n
.
SemanticException
protected NodeVisitor enterError(Node n)
ErrorHandlingVisitor
enter()
should its call to enterCall()
throw a
SemanticException
.
enterError
in class ErrorHandlingVisitor
n
- The root of the subtree that was traversed.
ErrorHandlingVisitor
which should be
used to visit the childre of n
.protected Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException
leaveCall
in class ErrorHandlingVisitor
old
- The original state of root of the current subtree.n
- The current state of the root of the current subtree.v
- The NodeVisitor
object used to visit the children.
n
.
SemanticException
NodeVisitor.leave(Node, Node, NodeVisitor)
public void throwsException(Type t, Position pos)
t
- The type of exception that the node throws.public SubtypeSet throwsSet()
public Position exceptionPosition(Type t)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |