diff options
Diffstat (limited to 'bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocatorParser.java')
-rw-r--r-- | bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocatorParser.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocatorParser.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocatorParser.java index fb9ad9b5..c68f165e 100644 --- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocatorParser.java +++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocatorParser.java @@ -294,22 +294,21 @@ public void parseBodies(CompilationUnitDeclaration unit) { ProgramElement[] statements = unit.statements; if (statements != null) for (int i = 0; i < statements.length; i++) { - if (statements[i] instanceof LocalDeclaration) - { + if (statements[i] instanceof LocalDeclaration){ ((LocalDeclaration)statements[i]).traverse(localDeclarationVisitor, null); - if (patternLocator instanceof FieldLocator) + if (patternLocator instanceof FieldLocator) { ((FieldLocator)patternLocator).matchLocalDeclaration((LocalDeclaration)statements[i], this.nodeSet); + } } - else if (statements[i] instanceof AbstractMethodDeclaration) - { - AbstractMethodDeclaration methodDeclaration=(AbstractMethodDeclaration)statements[i]; -// this.parse(methodDeclaration, unit); + + //check if the statement contains a method declaration + AbstractMethodDeclaration methodDeclaration = AbstractMethodDeclaration.findMethodDeclaration(statements[i]); + if (methodDeclaration != null && methodDeclaration instanceof MethodDeclaration) { methodDeclaration.traverse(localDeclarationVisitor, (Scope) null); - if (this.patternLocator instanceof MethodLocator) - ((MethodLocator)this.patternLocator).match((MethodDeclaration)statements[i], this.nodeSet); - + if (this.patternLocator instanceof MethodLocator) { + ((MethodLocator)this.patternLocator).match((MethodDeclaration)methodDeclaration, this.nodeSet); + } } - } unit.traverseInferredTypes(localDeclarationVisitor, null); |