Refactored packagename to net.sourceforge.phpdt.internal.compiler.ast
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / Initializer.java
index 6a8d049..4c5f8d6 100644 (file)
@@ -1,23 +1,21 @@
 /*******************************************************************************
- * 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.CodeStream;
+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.BlockScope;
 import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
 import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.parser.Parser;
+import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
 
 public class Initializer extends FieldDeclaration {
        
@@ -28,7 +26,7 @@ public class Initializer extends FieldDeclaration {
                this.block = block;
                this.modifiers = modifiers;
 
-               declarationSourceStart = sourceStart = block.sourceStart;
+               declarationSourceStart = sourceStart = bodyStart = block.sourceStart;
        }
 
        public FlowInfo analyseCode(
@@ -40,21 +38,21 @@ public class Initializer extends FieldDeclaration {
        }
 
        /**
-        * Code generation for a non-static initializer.
-        *      i.e. normal block code gen
+        * Code generation for a non-static initializer: 
+        *    standard block code gen
         *
-        * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
-        * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+        * @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() {
 
@@ -67,7 +65,7 @@ public class Initializer extends FieldDeclaration {
        }
 
        public void parseStatements(
-               Parser parser,
+               UnitParser parser,
                TypeDeclaration type,
                CompilationUnitDeclaration unit) {
 
@@ -109,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
+}