Set version 1.1.9
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / SourceElementParser.java
index dab8298..b7dda3f 100644 (file)
@@ -14,6 +14,20 @@ import java.util.ArrayList;
 
 import net.sourceforge.phpdt.core.compiler.CharOperation;
 import net.sourceforge.phpdt.core.compiler.IProblem;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.NameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
 import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
 import net.sourceforge.phpdt.internal.compiler.env.ISourceType;
 import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
@@ -23,22 +37,6 @@ import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
 import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
 import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
 import net.sourceforge.phpdt.internal.core.util.CommentRecorderParser;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AnonymousLocalTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MemberTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.NameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
 
 /**
  * A source element parser extracts structural and reference information
@@ -80,32 +78,22 @@ public class SourceElementParser extends CommentRecorderParser {//extends
   /**
    * An ast visitor that visits local type declarations.
    */
-  public class LocalDeclarationVisitor extends AbstractSyntaxTreeVisitorAdapter {
-    // public boolean visit(
-    //                 AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
-    //                 BlockScope scope) {
-    //         notifySourceElementRequestor(anonymousTypeDeclaration, sourceType ==
-    // null);
-    //         return false; // don't visit members as this was done during
-    // notifySourceElementRequestor(...)
-    // }
-    public boolean visit(LocalTypeDeclaration typeDeclaration, BlockScope scope) {
-      notifySourceElementRequestor(typeDeclaration, sourceType == null);
-      return false; // don't visit members as this was done during
-                    // notifySourceElementRequestor(...)
-    }
-    public boolean visit(MemberTypeDeclaration typeDeclaration, ClassScope scope) {
-      notifySourceElementRequestor(typeDeclaration, sourceType == null);
-      return false; // don't visit members as this was done during
-                    // notifySourceElementRequestor(...)
-    }
-
+  public class LocalDeclarationVisitor extends ASTVisitor {
+       public boolean visit(TypeDeclaration typeDeclaration, BlockScope scope) {
+               notifySourceElementRequestor(typeDeclaration, sourceType == null);
+               return false; // don't visit members as this was done during notifySourceElementRequestor(...)
+       }
+       public boolean visit(TypeDeclaration typeDeclaration, ClassScope scope) {
+               notifySourceElementRequestor(typeDeclaration, sourceType == null);
+               return false; // don't visit members as this was done during notifySourceElementRequestor(...)
+       }
+       
   }
 
   public SourceElementParser(final ISourceElementRequestor requestor, IProblemFactory problemFactory, CompilerOptions options) {
     // we want to notify all syntax error with the acceptProblem API
     // To do so, we define the record method of the ProblemReporter
-    super(new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
+    super( new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
       public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {
         unitResult.record(problem, referenceContext);
         if (requestor!=null) {
@@ -126,21 +114,21 @@ public class SourceElementParser extends CommentRecorderParser {//extends
    * @deprecated use SourceElementParser(ISourceElementRequestor,
    *             IProblemFactory, CompilerOptions)
    */
-  //public SourceElementParser(
-  //   final ISourceElementRequestor requestor,
-  //   IProblemFactory problemFactory) {
-  //           this(requestor, problemFactory, new CompilerOptions());
-  //}
-  //public SourceElementParser(
-  //   final ISourceElementRequestor requestor,
-  //   IProblemFactory problemFactory,
-  //   CompilerOptions options,
-  //   boolean reportLocalDeclarations) {
-  //           this(requestor, problemFactory, options);
-  //           if (reportLocalDeclarations) {
-  //                   this.localDeclarationVisitor = new LocalDeclarationVisitor();
-  //           }
-  //}
+  public SourceElementParser(
+       final ISourceElementRequestor requestor,
+       IProblemFactory problemFactory) {
+               this(requestor, problemFactory, new CompilerOptions());
+  }
+  public SourceElementParser(
+       final ISourceElementRequestor requestor,
+       IProblemFactory problemFactory,
+       CompilerOptions options,
+       boolean reportLocalDeclarations) {
+               this(requestor, problemFactory, options);
+               if (reportLocalDeclarations) {
+                       this.localDeclarationVisitor = new LocalDeclarationVisitor();
+               }
+  }
   //public void checkAnnotation() {
   //   int firstCommentIndex = scanner.commentPtr;
   //
@@ -921,7 +909,7 @@ public class SourceElementParser extends CommentRecorderParser {//extends
 
     FieldDeclaration[] fields = typeDeclaration.fields;
     AbstractMethodDeclaration[] methods = typeDeclaration.methods;
-    MemberTypeDeclaration[] memberTypes = typeDeclaration.memberTypes;
+    TypeDeclaration[] memberTypes = typeDeclaration.memberTypes;
     int fieldCount = fields == null ? 0 : fields.length;
     int methodCount = methods == null ? 0 : methods.length;
     int memberTypeCount = memberTypes == null ? 0 : memberTypes.length;