public class Try_c extends Stmt_c implements Try, TryOps
try
block, one or more
catch
blocks, and an optional finally
block.Term.Instance
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Catch> |
catchBlocks |
protected Block |
finallyBlock |
protected Block |
tryBlock |
exceptions, reachable
Constructor and Description |
---|
Try_c(Position pos,
Block tryBlock,
java.util.List<Catch> catchBlocks,
Block finallyBlock) |
Try_c(Position pos,
Block tryBlock,
java.util.List<Catch> catchBlocks,
Block finallyBlock,
Ext ext) |
Modifier and Type | Method and Description |
---|---|
<T> java.util.List<T> |
acceptCFG(CFGBuilder<?> v,
java.util.List<T> succs)
Visit this term in evaluation order, calling v.edge() for each successor
in succs, if data flows on that edge.
|
protected void |
assert_(Position pos,
Block tryBlock,
java.util.List<Catch> catchBlocks,
Block finallyBlock) |
java.util.List<Catch> |
catchBlocks()
List of catch blocks.
|
Try |
catchBlocks(java.util.List<Catch> catchBlocks)
Set the list of catch blocks.
|
protected <N extends Try_c> |
catchBlocks(N n,
java.util.List<Catch> catchBlocks) |
ExceptionChecker |
constructTryBlockExceptionChecker(ExceptionChecker ec)
Construct an ExceptionChecker that is suitable for checking the try block of
a try-catch-finally AST node.
|
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory.
|
Node |
exceptionCheck(ExceptionChecker ec)
Performs exceptionChecking.
|
java.util.List<Catch> |
exceptionCheckCatchBlocks(ExceptionChecker ec)
Perform exception checking of the catch blocks of a try-catch-finally
AST node, using the supplied exception checker.
|
NodeVisitor |
exceptionCheckEnter(ExceptionChecker ec)
Bypass all children when performing an exception check.
|
Block |
exceptionCheckFinallyBlock(ExceptionChecker ec)
Perform exception checking of the finally block of a try-catch-finally
AST node (if there is one), using the supplied exception checker.
|
Block |
exceptionCheckTryBlock(ExceptionChecker ec)
Perform exception checking of the try block of a try-catch-finally
AST node, using the supplied exception checker.
|
Block |
finallyBlock()
The block to "finally" execute.
|
Try |
finallyBlock(Block finallyBlock)
Set the block to "finally" execute.
|
protected <N extends Try_c> |
finallyBlock(N n,
Block finallyBlock) |
Term |
firstChild()
Return the first direct subterm performed when evaluating this term.
|
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter . |
protected <N extends Try_c> |
reconstruct(N n,
Block tryBlock,
java.util.List<Catch> catchBlocks,
Block finallyBlock)
Reconstruct the statement.
|
java.lang.String |
toString() |
Block |
tryBlock()
The block to "try".
|
Try |
tryBlock(Block tryBlock)
Set the block to "try".
|
protected <N extends Try_c> |
tryBlock(N n,
Block tryBlock) |
Node |
visitChildren(NodeVisitor v)
Visit the children of the node.
|
exceptions, exceptions, exceptions, extRewrite, listChild, reachable, reachable, reachable
addDecls, buildTypes, buildTypesEnter, checkConstants, childExpectedType, copy, copy, copyIfNeeded, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, dump, enterChildScope, enterScope, error, error, error, ext, ext, ext, ext, extRewriteEnter, isDisambiguated, isTypeChecked, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, translate, typeCheck, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
exceptions, exceptions, reachable, reachable
del, del, dump, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypes, buildTypesEnter, checkConstants, childExpectedType, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, extRewrite, extRewriteEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, throwTypes, translate, typeCheck, typeCheckEnter, typeCheckOverride, visitChild, visitList
protected Block tryBlock
protected java.util.List<Catch> catchBlocks
protected Block finallyBlock
public Try_c(Position pos, Block tryBlock, java.util.List<Catch> catchBlocks, Block finallyBlock)
protected void assert_(Position pos, Block tryBlock, java.util.List<Catch> catchBlocks, Block finallyBlock)
public Try tryBlock(Block tryBlock)
Try
public java.util.List<Catch> catchBlocks()
Try
catchBlocks
in interface Try
Catch
.public Try catchBlocks(java.util.List<Catch> catchBlocks)
Try
catchBlocks
in interface Try
catchBlocks
- A list of Catch
.public Block finallyBlock()
Try
finallyBlock
in interface Try
public Try finallyBlock(Block finallyBlock)
Try
finallyBlock
in interface Try
protected <N extends Try_c> N reconstruct(N n, Block tryBlock, java.util.List<Catch> catchBlocks, Block finallyBlock)
public Node visitChildren(NodeVisitor v)
NodeOps
visitChildren
in interface NodeOps
visitChildren
in class Node_c
v
- The visitor that will traverse/rewrite the AST.this
.public NodeVisitor exceptionCheckEnter(ExceptionChecker ec) throws SemanticException
exceptionCheckEnter
in interface NodeOps
exceptionCheckEnter
in class Node_c
ec
- The visitor.SemanticException
public Node exceptionCheck(ExceptionChecker ec) throws SemanticException
exceptionCheck
in interface NodeOps
exceptionCheck
in class Term_c
ec
- The ExceptionChecker that was run against the
child node. It contains the exceptions that can be thrown by the try
block.SemanticException
public Block exceptionCheckTryBlock(ExceptionChecker ec)
TryOps
exceptionCheckTryBlock
in interface TryOps
public ExceptionChecker constructTryBlockExceptionChecker(ExceptionChecker ec)
TryOps
constructTryBlockExceptionChecker
in interface TryOps
ec
- The exception checker immediately prior to the try block.public java.util.List<Catch> exceptionCheckCatchBlocks(ExceptionChecker ec) throws SemanticException
TryOps
exceptionCheckCatchBlocks
in interface TryOps
SemanticException
public Block exceptionCheckFinallyBlock(ExceptionChecker ec)
TryOps
exceptionCheckFinallyBlock
in interface TryOps
public void prettyPrint(CodeWriter w, PrettyPrinter tr)
Node_c
CodeWriter
.prettyPrint
in interface NodeOps
prettyPrint
in class Node_c
w
- The code writer to which to write.tr
- The pretty printer. This is not a visitor.public Term firstChild()
TermOps
firstChild
in interface TermOps
firstChild
in class Term_c
public <T> java.util.List<T> acceptCFG(CFGBuilder<?> v, java.util.List<T> succs)
TermOps