Refactory: smarty.ui plugin.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / flow / InitializationFlowContext.java
index 11a8759..03b3e3b 100644 (file)
  *******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.flow;
 
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
 import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
 
 /**
- * Reflects the context of code analysis, keeping track of enclosing
- *     try statements, exception handlers, etc...
+ * Reflects the context of code analysis, keeping track of enclosing try
+ * statements, exception handlers, etc...
  */
 public class InitializationFlowContext extends ExceptionHandlingFlowContext {
 
        public int exceptionCount;
+
        public TypeBinding[] thrownExceptions = new TypeBinding[5];
+
        public ASTNode[] exceptionThrowers = new ASTNode[5];
+
        public FlowInfo[] exceptionThrowerFlowInfos = new FlowInfo[5];
-       
-       public InitializationFlowContext(
-               FlowContext parent,
-               ASTNode associatedNode,
-               BlockScope scope) {
-               super(
-                       parent,
-                       associatedNode,
-                       NoExceptions, // no exception allowed by default
-                       scope, 
-                       FlowInfo.DEAD_END);
+
+       public InitializationFlowContext(FlowContext parent,
+                       ASTNode associatedNode, BlockScope scope) {
+               super(parent, associatedNode, NoExceptions, // no exception allowed by
+                                                                                                       // default
+                               scope, FlowInfo.DEAD_END);
        }
 
-       public void checkInitializerExceptions(
-               BlockScope currentScope,
-               FlowContext initializerContext,
-               FlowInfo flowInfo) {
+       public void checkInitializerExceptions(BlockScope currentScope,
+                       FlowContext initializerContext, FlowInfo flowInfo) {
                for (int i = 0; i < exceptionCount; i++) {
-                       initializerContext.checkExceptionHandlers(
-                               thrownExceptions[i],
-                               exceptionThrowers[i],
-                               exceptionThrowerFlowInfos[i],
-                               currentScope);
+                       initializerContext.checkExceptionHandlers(thrownExceptions[i],
+                                       exceptionThrowers[i], exceptionThrowerFlowInfos[i],
+                                       currentScope);
                }
        }
 
        public String individualToString() {
-               
+
                StringBuffer buffer = new StringBuffer("Initialization flow context"); //$NON-NLS-1$
                for (int i = 0; i < exceptionCount; i++) {
                        buffer.append('[').append(thrownExceptions[i].readableName());
-                       buffer.append('-').append(exceptionThrowerFlowInfos[i].toString()).append(']');
+                       buffer.append('-').append(exceptionThrowerFlowInfos[i].toString())
+                                       .append(']');
                }
                return buffer.toString();
        }
-       
-       public void recordHandlingException(
-               ReferenceBinding exceptionType,
-               UnconditionalFlowInfo flowInfo,
-               TypeBinding raisedException,
-               ASTNode invocationSite,
-               boolean wasMasked) {
-                       
-               // even if unreachable code, need to perform unhandled exception diagnosis
+
+       public void recordHandlingException(ReferenceBinding exceptionType,
+                       UnconditionalFlowInfo flowInfo, TypeBinding raisedException,
+                       ASTNode invocationSite, boolean wasMasked) {
+
+               // even if unreachable code, need to perform unhandled exception
+               // diagnosis
                int size = thrownExceptions.length;
                if (exceptionCount == size) {
-                       System.arraycopy(
-                               thrownExceptions,
-                               0,
-                               (thrownExceptions = new TypeBinding[size * 2]),
-                               0,
-                               size);
-                       System.arraycopy(
-                               exceptionThrowers,
-                               0,
-                               (exceptionThrowers = new ASTNode[size * 2]),
-                               0,
-                               size);
-                       System.arraycopy(
-                               exceptionThrowerFlowInfos,
-                               0,
-                               (exceptionThrowerFlowInfos = new FlowInfo[size * 2]),
-                               0,
-                               size);
+                       System.arraycopy(thrownExceptions, 0,
+                                       (thrownExceptions = new TypeBinding[size * 2]), 0, size);
+                       System.arraycopy(exceptionThrowers, 0,
+                                       (exceptionThrowers = new ASTNode[size * 2]), 0, size);
+                       System.arraycopy(exceptionThrowerFlowInfos, 0,
+                                       (exceptionThrowerFlowInfos = new FlowInfo[size * 2]), 0,
+                                       size);
                }
                thrownExceptions[exceptionCount] = raisedException;
                exceptionThrowers[exceptionCount] = invocationSite;
                exceptionThrowerFlowInfos[exceptionCount++] = flowInfo.copy();
-       }       
+       }
 }