1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.flow;
13 import net.sourceforge.phpdt.internal.compiler.ast.AstNode;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
15 import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
16 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
19 * Reflects the context of code analysis, keeping track of enclosing
20 * try statements, exception handlers, etc...
22 public class InitializationFlowContext extends ExceptionHandlingFlowContext {
24 public int exceptionCount;
25 public TypeBinding[] thrownExceptions = new TypeBinding[5];
26 public AstNode[] exceptionThrowers = new AstNode[5];
27 public FlowInfo[] exceptionThrowerFlowInfos = new FlowInfo[5];
29 public InitializationFlowContext(
31 AstNode associatedNode,
36 new ReferenceBinding[] { scope.getJavaLangThrowable()},
37 // tolerate any kind of exception, but record them
38 scope, FlowInfo.DeadEnd);
41 public void checkInitializerExceptions(
42 BlockScope currentScope,
43 FlowContext initializerContext,
45 for (int i = 0; i < exceptionCount; i++) {
46 initializerContext.checkExceptionHandlers(
49 exceptionThrowerFlowInfos[i],
54 public void recordHandlingException(
55 ReferenceBinding exceptionType,
56 UnconditionalFlowInfo flowInfo,
57 TypeBinding raisedException,
58 AstNode invocationSite,
61 int size = thrownExceptions.length;
62 if (exceptionCount == size) {
66 (thrownExceptions = new TypeBinding[size * 2]),
72 (exceptionThrowers = new AstNode[size * 2]),
76 exceptionThrowerFlowInfos,
78 (exceptionThrowerFlowInfos = new FlowInfo[size * 2]),
82 thrownExceptions[exceptionCount] = raisedException;
83 exceptionThrowers[exceptionCount] = invocationSite;
84 exceptionThrowerFlowInfos[exceptionCount++] = flowInfo.copy();