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;
-import org.eclipse.core.resources.IResource;
-
/**
* A source element parser extracts structural and reference information
* from a piece of source.
/**
* 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) {
* @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;
//
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;