1) Moved net.sourceforge.phpeclipse.ui\src\net\sourceforge\phpdt back to net.sourcefo...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / Initializer.java
index 858198c..16bc51a 100644 (file)
@@ -1,58 +1,61 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Common Public License v0.5 
+ * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
+ * http://www.eclipse.org/legal/cpl-v10.html
  * 
  * Contributors:
  *     IBM Corporation - initial API and implementation
- ******************************************************************************/
+ *******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.ast;
 
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.*;
-import net.sourceforge.phpdt.internal.compiler.flow.*;
-import net.sourceforge.phpdt.internal.compiler.lookup.*;
-import net.sourceforge.phpdt.internal.compiler.parser.*;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
 
 public class Initializer extends FieldDeclaration {
-       
+
        public Block block;
+
        public int lastFieldID;
+
        public int bodyStart;
+
        public Initializer(Block block, int modifiers) {
                this.block = block;
                this.modifiers = modifiers;
 
-               declarationSourceStart = sourceStart = block.sourceStart;
+               declarationSourceStart = sourceStart = bodyStart = block.sourceStart;
        }
 
-       public FlowInfo analyseCode(
-               MethodScope currentScope,
-               FlowContext flowContext,
-               FlowInfo flowInfo) {
+       public FlowInfo analyseCode(MethodScope currentScope,
+                       FlowContext flowContext, FlowInfo flowInfo) {
 
                return block.analyseCode(currentScope, flowContext, flowInfo);
        }
 
        /**
-        * Code generation for a non-static initializer.
-        *      i.e. normal block code gen
-        *
-        * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
-        * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+        * Code generation for a non-static initializer: standard block code gen
+        * 
+        * @param currentScope
+        *            net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+        * @param codeStream
+        *            net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
         */
-       public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-
-               if ((bits & IsReachableMASK) == 0) {
-                       return;
-               }
-               int pc = codeStream.position;
-               block.generateCode(currentScope, codeStream);
-               codeStream.recordPositionsFrom(pc, this.sourceStart);
-       }
-
+       // public void generateCode(BlockScope currentScope, CodeStream codeStream)
+       // {
+       //
+       // if ((bits & IsReachableMASK) == 0) {
+       // return;
+       // }
+       // int pc = codeStream.position;
+       // block.generateCode(currentScope, codeStream);
+       // codeStream.recordPositionsFrom(pc, this.sourceStart);
+       // }
        public boolean isField() {
 
                return false;
@@ -63,12 +66,10 @@ public class Initializer extends FieldDeclaration {
                return (modifiers & AccStatic) != 0;
        }
 
-       public void parseStatements(
-               Parser parser,
-               TypeDeclaration type,
-               CompilationUnitDeclaration unit) {
+       public void parseStatements(UnitParser parser, TypeDeclaration type,
+                       CompilationUnitDeclaration unit) {
 
-               //fill up the method body with statement
+               // fill up the method body with statement
                parser.parse(this, type, unit);
        }
 
@@ -80,9 +81,9 @@ public class Initializer extends FieldDeclaration {
                        if (isStatic()) {
                                ReferenceBinding declaringType = scope.enclosingSourceType();
                                if (declaringType.isNestedType() && !declaringType.isStatic())
-                                       scope.problemReporter().innerTypesCannotDeclareStaticInitializers(
-                                               declaringType,
-                                               this);
+                                       scope.problemReporter()
+                                                       .innerTypesCannotDeclareStaticInitializers(
+                                                                       declaringType, this);
                        }
                        block.resolve(scope);
                } finally {
@@ -106,11 +107,11 @@ public class Initializer extends FieldDeclaration {
                }
        }
 
-       public void traverse(IAbstractSyntaxTreeVisitor visitor, MethodScope scope) {
+       public void traverse(ASTVisitor visitor, MethodScope scope) {
 
                if (visitor.visit(this, scope)) {
                        block.traverse(visitor, scope);
                }
-               visitor.visit(this, scope);
+               visitor.endVisit(this, scope);
        }
-}
\ No newline at end of file
+}