A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / AnonymousLocalTypeDeclaration.java
index 73b3689..841196d 100644 (file)
@@ -22,27 +22,30 @@ import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
 public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
 
        public static final char[] ANONYMOUS_EMPTY_NAME = new char[] {};
+
        public QualifiedAllocationExpression allocation;
 
        public AnonymousLocalTypeDeclaration(CompilationResult compilationResult) {
                super(compilationResult);
                modifiers = AccDefault;
                name = ANONYMOUS_EMPTY_NAME;
-       } 
-       
-       // use a default name in order to th name lookup 
+       }
+
+       // use a default name in order to th name lookup
        // to operate just like a regular type (which has a name)
-       //without checking systematically if the naem is null .... 
-       public MethodBinding createsInternalConstructorWithBinding(MethodBinding inheritedConstructorBinding) {
+       // without checking systematically if the naem is null ....
+       public MethodBinding createsInternalConstructorWithBinding(
+                       MethodBinding inheritedConstructorBinding) {
 
-               //Add to method'set, the default constuctor that just recall the
-               //super constructor with the same arguments
+               // Add to method'set, the default constuctor that just recall the
+               // super constructor with the same arguments
                String baseName = "$anonymous"; //$NON-NLS-1$
                TypeBinding[] argumentTypes = inheritedConstructorBinding.parameters;
                int argumentsLength = argumentTypes.length;
-               //the constructor
-               ConstructorDeclaration cd = new ConstructorDeclaration(this.compilationResult);
-               cd.selector = new char[] { 'x' }; //no maining
+               // the constructor
+               ConstructorDeclaration cd = new ConstructorDeclaration(
+                               this.compilationResult);
+               cd.selector = new char[] { 'x' }; // no maining
                cd.sourceStart = sourceStart;
                cd.sourceEnd = sourceEnd;
                cd.modifiers = modifiers & AccVisibilityMASK;
@@ -51,11 +54,12 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
                if (argumentsLength > 0) {
                        Argument[] arguments = (cd.arguments = new Argument[argumentsLength]);
                        for (int i = argumentsLength; --i >= 0;) {
-                               arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, AccDefault);
+                               arguments[i] = new Argument((baseName + i).toCharArray(), 0L,
+                                               null /* type ref */, AccDefault);
                        }
                }
 
-               //the super call inside the constructor
+               // the super call inside the constructor
                cd.constructorCall = SuperReference.implicitSuperConstructorCall();
                cd.constructorCall.sourceStart = sourceStart;
                cd.constructorCall.sourceEnd = sourceEnd;
@@ -64,32 +68,33 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
                        Expression[] args;
                        args = cd.constructorCall.arguments = new Expression[argumentsLength];
                        for (int i = argumentsLength; --i >= 0;) {
-                               args[i] = new SingleNameReference((baseName + i).toCharArray(), 0L);
+                               args[i] = new SingleNameReference((baseName + i).toCharArray(),
+                                               0L);
                        }
                }
 
-               //adding the constructor in the methods list
+               // adding the constructor in the methods list
                if (methods == null) {
                        methods = new AbstractMethodDeclaration[] { cd };
                } else {
                        AbstractMethodDeclaration[] newMethods;
-                       System.arraycopy(
-                               methods,
-                               0,
-                               newMethods = new AbstractMethodDeclaration[methods.length + 1],
-                               1,
-                               methods.length);
+                       System
+                                       .arraycopy(
+                                                       methods,
+                                                       0,
+                                                       newMethods = new AbstractMethodDeclaration[methods.length + 1],
+                                                       1, methods.length);
                        newMethods[0] = cd;
                        methods = newMethods;
                }
 
-               //============BINDING UPDATE==========================
-               cd.binding = new MethodBinding(
-                               cd.modifiers, //methodDeclaration
-                               argumentsLength == 0 ? NoParameters : argumentTypes, //arguments bindings
-                               inheritedConstructorBinding.thrownExceptions, //exceptions
-                               binding); //declaringClass
-                               
+               // ============BINDING UPDATE==========================
+               cd.binding = new MethodBinding(cd.modifiers, // methodDeclaration
+                               argumentsLength == 0 ? NoParameters : argumentTypes, // arguments
+                                                                                                                                               // bindings
+                               inheritedConstructorBinding.thrownExceptions, // exceptions
+                               binding); // declaringClass
+
                cd.scope = new MethodScope(scope, cd, true);
                cd.bindArguments();
                cd.constructorCall.resolve(cd.scope);
@@ -98,27 +103,25 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
                        binding.methods = new MethodBinding[] { cd.binding };
                } else {
                        MethodBinding[] newMethods;
-                       System.arraycopy(
-                               binding.methods,
-                               0,
-                               newMethods = new MethodBinding[binding.methods.length + 1],
-                               1,
-                               binding.methods.length);
+                       System.arraycopy(binding.methods, 0,
+                                       newMethods = new MethodBinding[binding.methods.length + 1],
+                                       1, binding.methods.length);
                        newMethods[0] = cd.binding;
                        binding.methods = newMethods;
                }
-               //===================================================
+               // ===================================================
 
                return cd.binding;
 
        }
+
        public void resolve(BlockScope scope) {
 
                if (binding != null) {
                        // remember local types binding for innerclass emulation propagation
-                       scope.referenceCompilationUnit().record((LocalTypeBinding)binding);
+                       scope.referenceCompilationUnit().record((LocalTypeBinding) binding);
                }
-               // scope and binding are provided in updateBindingSuperclass 
+               // scope and binding are provided in updateBindingSuperclass
                resolve();
                updateMaxFieldCount();
        }
@@ -129,12 +132,10 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
        }
 
        /**
-        *      Iteration for a local anonymous innertype
-        *
+        * Iteration for a local anonymous innertype
+        * 
         */
-       public void traverse(
-           ASTVisitor visitor,
-               BlockScope blockScope) {
+       public void traverse(ASTVisitor visitor, BlockScope blockScope) {
 
                if (ignoreFurtherInvestigation)
                        return;
@@ -145,7 +146,8 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
                                int methodsLength;
                                int memberTypesLength;
 
-                               // <superclass> is bound to the actual type from the allocation expression
+                               // <superclass> is bound to the actual type from the allocation
+                               // expression
                                // therefore it has already been iterated at this point.
 
                                if (memberTypes != null) {