public class ExceptionChecker extends ErrorHandlingVisitor
Modifier and Type | Class and Description |
---|---|
static class |
ExceptionChecker.CodeTypeReporter |
static class |
ExceptionChecker.UncaughtReporter |
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<Type> |
catchable
Set of exceptions that can be caught.
|
protected boolean |
catchAllThrowable
Should the propagation of exceptions upwards go past this point?
|
protected ExceptionChecker |
outer |
protected ExceptionChecker.UncaughtReporter |
reporter
Responsible for creating an appropriate SemanticException
to report an uncaught exception.
|
protected SubtypeSet |
throwsSet
The throws set, calculated bottom up.
|
error, job, nf, ts
bypass, bypassParent
Constructor and Description |
---|
ExceptionChecker(Job job,
TypeSystem ts,
NodeFactory nf) |
Modifier and Type | Method and Description |
---|---|
protected NodeVisitor |
enterCall(Node n) |
protected NodeVisitor |
enterError(Node n)
This method determines what should be returned by
enter()
should its call to enterCall() throw a
SemanticException . |
JLang |
lang() |
protected Node |
leaveCall(Node old,
Node n,
NodeVisitor v)
Call exceptionCheck(ExceptionChecker) on the node.
|
ExceptionChecker |
pop() |
ExceptionChecker |
push() |
ExceptionChecker |
push(java.util.Collection<? extends Type> catchableTypes) |
ExceptionChecker |
push(ExceptionChecker.UncaughtReporter reporter) |
ExceptionChecker |
push(Type catchableType) |
ExceptionChecker |
pushCatchAllThrowable() |
protected void |
reportUncaughtException(Type t,
Position pos) |
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() |
begin, catchErrors, enter, enterCall, errorQueue, hasErrors, job, leave, leaveCall, leaveCall, nodeFactory, typeSystem
bypass, bypass, bypassChildren, override, visitChildren
copy, enter, finish, finish, leave, override, toString, visitEdge, visitEdgeNoOverride
protected ExceptionChecker outer
protected java.util.Set<Type> catchable
protected SubtypeSet throwsSet
protected ExceptionChecker.UncaughtReporter reporter
protected boolean catchAllThrowable
public ExceptionChecker(Job job, TypeSystem ts, NodeFactory nf)
public JLang lang()
lang
in class NodeVisitor
public ExceptionChecker push(ExceptionChecker.UncaughtReporter reporter)
public ExceptionChecker push(Type catchableType)
public ExceptionChecker push(java.util.Collection<? extends Type> catchableTypes)
public ExceptionChecker pushCatchAllThrowable()
public ExceptionChecker push()
public ExceptionChecker pop()
protected NodeVisitor enterCall(Node n) throws SemanticException
enterCall
in class ErrorHandlingVisitor
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 children 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
public void throwsException(Type t, Position pos) throws SemanticException
t
- The type of exception that the node throws.SemanticException
public SubtypeSet throwsSet()
protected void reportUncaughtException(Type t, Position pos) throws SemanticException
SemanticException