📄 trystmt.java
字号:
package AST;
import java.util.HashSet;import java.util.LinkedHashSet;import java.io.FileNotFoundException;import java.io.File;import java.util.*;import beaver.*;import java.util.ArrayList;import java.util.zip.*;import java.io.*;public class TryStmt extends Stmt implements Cloneable, FinallyHost {
public void flushCache() { super.flushCache(); branches_visited = -1; branches_computed = false; branches_value = null; branchesFromFinally_visited = -1; branchesFromFinally_computed = false; branchesFromFinally_value = null; targetBranches_visited = -1; targetBranches_computed = false; targetBranches_value = null; escapedBranches_visited = -1; escapedBranches_computed = false; escapedBranches_value = null; isDAafter_Variable_visited = new java.util.HashMap(4); isDAafter_Variable_values = null; isDUafterFinally_Variable_visited = new java.util.HashMap(4); isDAafterFinally_Variable_visited = new java.util.HashMap(4); isDUbefore_Variable_visited = new java.util.HashMap(4); isDUafter_Variable_visited = new java.util.HashMap(4); isDUafter_Variable_values = null; reachableThrow_CatchClause_visited = new java.util.HashMap(4); reachableThrow_CatchClause_values = null; canCompleteNormally_visited = -1; canCompleteNormally_computed = false; handlesException_TypeDecl_visited = new java.util.HashMap(4); handlesException_TypeDecl_values = null; typeError_visited = -1; typeError_computed = false; typeError_value = null; typeRuntimeException_visited = -1; typeRuntimeException_computed = false; typeRuntimeException_value = null; } @SuppressWarnings({"unchecked", "cast"}) public TryStmt clone() throws CloneNotSupportedException { TryStmt node = (TryStmt)super.clone(); node.branches_visited = -1; node.branches_computed = false; node.branches_value = null; node.branchesFromFinally_visited = -1; node.branchesFromFinally_computed = false; node.branchesFromFinally_value = null; node.targetBranches_visited = -1; node.targetBranches_computed = false; node.targetBranches_value = null; node.escapedBranches_visited = -1; node.escapedBranches_computed = false; node.escapedBranches_value = null; node.isDAafter_Variable_visited = new java.util.HashMap(4); node.isDAafter_Variable_values = null; node.isDUafterFinally_Variable_visited = new java.util.HashMap(4); node.isDAafterFinally_Variable_visited = new java.util.HashMap(4); node.isDUbefore_Variable_visited = new java.util.HashMap(4); node.isDUafter_Variable_visited = new java.util.HashMap(4); node.isDUafter_Variable_values = null; node.reachableThrow_CatchClause_visited = new java.util.HashMap(4); node.reachableThrow_CatchClause_values = null; node.canCompleteNormally_visited = -1; node.canCompleteNormally_computed = false; node.handlesException_TypeDecl_visited = new java.util.HashMap(4); node.handlesException_TypeDecl_values = null; node.typeError_visited = -1; node.typeError_computed = false; node.typeError_value = null; node.typeRuntimeException_visited = -1; node.typeRuntimeException_computed = false; node.typeRuntimeException_value = null; node.in$Circle(false); node.is$Final(false); return node; } @SuppressWarnings({"unchecked", "cast"}) public TryStmt copy() { try { TryStmt node = (TryStmt)clone(); if(children != null) node.children = (ASTNode[])children.clone(); return node; } catch (CloneNotSupportedException e) { } System.err.println("Error: Could not clone node of type " + getClass().getName() + "!"); return null; } @SuppressWarnings({"unchecked", "cast"}) public TryStmt fullCopy() { TryStmt res = (TryStmt)copy(); for(int i = 0; i < getNumChildNoTransform(); i++) { ASTNode node = getChildNoTransform(i); if(node != null) node = node.fullCopy(); res.setChild(node, i); } return res; } // Declared in BranchTarget.jrag at line 61 public void collectBranches(Collection c) { c.addAll(escapedBranches()); } // Declared in BranchTarget.jrag at line 162 public Stmt branchTarget(Stmt branchStmt) { if(targetBranches().contains(branchStmt)) return this; return super.branchTarget(branchStmt); } // Declared in BranchTarget.jrag at line 200 public void collectFinally(Stmt branchStmt, ArrayList list) { if(hasFinally() && !branchesFromFinally().contains(branchStmt)) list.add(this); if(targetBranches().contains(branchStmt)) return; super.collectFinally(branchStmt, list); } // Declared in ExceptionHandling.jrag at line 203 protected boolean reachedException(TypeDecl type) { boolean found = false; // found is true if the exception type is caught by a catch clause for(int i = 0; i < getNumCatchClause() && !found; i++) if(getCatchClause(i).handles(type)) found = true; // if an exception is thrown in the block and the exception is not caught and // either there is no finally block or the finally block can complete normally if(!found && (!hasFinally() || getFinally().canCompleteNormally()) ) if(getBlock().reachedException(type)) return true; // even if the exception is caught by the catch clauses they may // throw new exceptions for(int i = 0; i < getNumCatchClause() && found; i++) if(getCatchClause(i).reachedException(type)) return true; return hasFinally() && getFinally().reachedException(type); } // Declared in PrettyPrint.jadd at line 712 public void toString(StringBuffer s) { s.append("try "); getBlock().toString(s); for(int i = 0; i < getNumCatchClause(); i++) { s.append(indent()); getCatchClause(i).toString(s); } if(hasFinally()) { s.append(indent()); s.append("finally "); getFinally().toString(s); } } // Declared in java.ast at line 3 // Declared in java.ast line 222
public TryStmt() { super();
setChild(new List(), 1);
setChild(new Opt(), 2);
} // Declared in java.ast at line 12
// Declared in java.ast line 222 public TryStmt(Block p0, List<CatchClause> p1, Opt<Block> p2) { setChild(p0, 0); setChild(p1, 1); setChild(p2, 2); } // Declared in java.ast at line 18 protected int numChildren() {
return 3;
} // Declared in java.ast at line 21
public boolean mayHaveRewrite() { return false; } // Declared in java.ast at line 2 // Declared in java.ast line 222 public void setBlock(Block node) { setChild(node, 0); } // Declared in java.ast at line 5 public Block getBlock() { return (Block)getChild(0); } // Declared in java.ast at line 9 public Block getBlockNoTransform() { return (Block)getChildNoTransform(0); } // Declared in java.ast at line 2 // Declared in java.ast line 222 public void setCatchClauseList(List<CatchClause> list) { setChild(list, 1); } // Declared in java.ast at line 6 private int getNumCatchClause = 0; // Declared in java.ast at line 7 public int getNumCatchClause() { return getCatchClauseList().getNumChild(); } // Declared in java.ast at line 11 @SuppressWarnings({"unchecked", "cast"}) public CatchClause getCatchClause(int i) { return (CatchClause)getCatchClauseList().getChild(i); } // Declared in java.ast at line 15 public void addCatchClause(CatchClause node) { List<CatchClause> list = getCatchClauseList(); list.addChild(node); } // Declared in java.ast at line 20 public void setCatchClause(CatchClause node, int i) { List<CatchClause> list = getCatchClauseList(); list.setChild(node, i); } // Declared in java.ast at line 24 public List<CatchClause> getCatchClauses() { return getCatchClauseList(); } // Declared in java.ast at line 27 public List<CatchClause> getCatchClausesNoTransform() { return getCatchClauseListNoTransform(); } // Declared in java.ast at line 31 @SuppressWarnings({"unchecked", "cast"}) public List<CatchClause> getCatchClauseList() { return (List<CatchClause>)getChild(1); } // Declared in java.ast at line 35 @SuppressWarnings({"unchecked", "cast"}) public List<CatchClause> getCatchClauseListNoTransform() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -