public static CatchStatement catchS(Parameter variable, Statement code) { return new CatchStatement(variable, code); }
@Override public void visitTryCatchFinally(final TryCatchStatement statement) { final List<CatchStatement> catchStatements = statement.getCatchStatements(); for (CatchStatement catchStatement : catchStatements) { ClassNode exceptionType = catchStatement.getExceptionType(); typeCheckingContext.controlStructureVariables.put(catchStatement.getVariable(), exceptionType); } try { super.visitTryCatchFinally(statement); } finally { for (CatchStatement catchStatement : catchStatements) { typeCheckingContext.controlStructureVariables.remove(catchStatement.getVariable()); } } }
private void visitCatchFinally(Map<Variable, VariableState> initialVarState, List<Map<Variable, VariableState>> afterTryCatchStates, CatchStatement catchStatement, Statement finallyStatement) { pushState(); // getState().clear(); getState().putAll(initialVarState); Statement code = catchStatement.getCode(); catchStatement.visit(this); visitPossiblyEmptyStatement(finallyStatement); if (code == null || !returningBlock(code)) { afterTryCatchStates.add(new HashMap<Variable, VariableState>(getState())); } popState(); }
ClassNode exceptionType = catchStatement.getExceptionType(); String exceptionTypeInternalName = BytecodeHelper.getClassInternalName(exceptionType); Parameter exceptionVariable = catchStatement.getVariable(); compileStack.pushState(); compileStack.defineVariable(exceptionVariable, true); catchStatement.visit(controller.getAcg());
@Override public void visitCatchStatement(CatchStatement statement) { varStack.getLast().add(statement.getVariable().getName()); super.visitCatchStatement(statement); varStack.getLast().remove(statement.getVariable().getName()); }
@Override public void visitCatchStatement(CatchStatement statement) { statement.getCode().visit(this); }
@Override public void run() { literal(stmt.getExceptionType()); literal(stmt.getVariable().getName()); visit(stmt.getCode()); } });
public void visitCatchStatement(CatchStatement cs) { if (!(cs.getExceptionType().isDerivedFrom(ClassHelper.make(Throwable.class)))) { addError("Catch statement parameter type is not a subclass of Throwable.", cs); } super.visitCatchStatement(cs); }
public void visitTryCatchFinally(TryCatchStatement statement) { statement.getTryStatement().visit(this); for (CatchStatement catchStatement : statement.getCatchStatements()) { catchStatement.visit(this); } Statement finallyStatement = statement.getFinallyStatement(); if (finallyStatement instanceof EmptyStatement) { // dispatching to EmptyStatement will not call back visitor, // must call our visitEmptyStatement explicitly visitEmptyStatement((EmptyStatement) finallyStatement); } else { finallyStatement.visit(this); } }
ClassNode exceptionType = catchStatement.getExceptionType(); compileStack.defineVariable(catchStatement.getVariable(), true); catchStatement.visit(this); compileStack.pop();
@Override public void visitCatchStatement(CatchStatement statement) { super.visitCatchStatement(statement); addToCache(statement.getVariable().getType()); } @Override
public void visitCatchStatement(CatchStatement statement) { statement.getCode().visit(this); }
@Override public void visitCatchStatement(CatchStatement statement) { // Add reference to class exception if (classes.containsKey(statement.getExceptionType().getName())) { indexer.addReference(classes.get(statement.getExceptionType().getName()), createLocation(statement.getExceptionType())); } // TODO(#125): add a symbol for the exception variables. Right now statement.getVariable() returns a Parameter // with an invalid location. super.visitCatchStatement(statement); }
public void visitTryCatchFinally(final TryCatchStatement statement) { assertStatementAuthorized(statement); statement.getTryStatement().visit(this); for (CatchStatement catchStatement : statement.getCatchStatements()) { catchStatement.visit(this); } Statement finallyStatement = statement.getFinallyStatement(); if (finallyStatement instanceof EmptyStatement) { // dispatching to EmptyStatement will not call back visitor, // must call our visitEmptyStatement explicitly visitEmptyStatement((EmptyStatement) finallyStatement); } else { finallyStatement.visit(this); } }
ClassNode exceptionType = catchStatement.getExceptionType(); compileStack.defineVariable(catchStatement.getVariable(), true); catchStatement.visit(this); compileStack.pop();
public void visitCatchStatement(CatchStatement cs) { resolveOrFail(cs.getExceptionType(), cs); if (cs.getExceptionType() == ClassHelper.DYNAMIC_TYPE) { cs.getVariable().setType(ClassHelper.make(Exception.class)); } super.visitCatchStatement(cs); }
private TryCatchStatement tryCatchAssertionFailedError(AnnotationNode annotationNode, MethodNode methodNode, ArrayList<Statement> statements) { TryCatchStatement tryCatchStatement = new TryCatchStatement(new BlockStatement(statements, methodNode.getVariableScope()), EmptyStatement.INSTANCE); tryCatchStatement.addCatch(new CatchStatement(new Parameter(CATCHED_THROWABLE_TYPE, "ex"), ReturnStatement.RETURN_NULL_OR_VOID)); return tryCatchStatement; }
public void visitCatchStatement(CatchStatement statement) { pushState(); Parameter p = statement.getVariable(); p.setInStaticContext(currentScope.isInStaticContext()); declare(p, statement); super.visitCatchStatement(statement); popState(); }