| Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/NameOccurrencesFinder.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/NameOccurrencesFinder.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/NameOccurrencesFinder.java
|
| index a4d35edc56da5fd92c1d7135e088cc8108f72160..d4984017fdea273c92121d3ef3b8d55135692b67 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/NameOccurrencesFinder.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/NameOccurrencesFinder.java
|
| @@ -1,12 +1,13 @@
|
| package com.google.dart.tools.core.utilities.ast;
|
|
|
| +import com.google.dart.compiler.ast.ASTVisitor;
|
| import com.google.dart.compiler.ast.DartFunction;
|
| import com.google.dart.compiler.ast.DartFunctionTypeAlias;
|
| import com.google.dart.compiler.ast.DartMethodDefinition;
|
| import com.google.dart.compiler.ast.DartNode;
|
| -import com.google.dart.compiler.ast.ASTVisitor;
|
| import com.google.dart.compiler.ast.DartParameter;
|
| import com.google.dart.compiler.resolver.Element;
|
| +import com.google.dart.compiler.resolver.NodeElement;
|
| import com.google.dart.compiler.resolver.VariableElement;
|
|
|
| import java.util.ArrayList;
|
| @@ -55,14 +56,16 @@ public class NameOccurrencesFinder extends ASTVisitor<Void> {
|
| }
|
|
|
| private DartNode findTargetContainer() {
|
| - if (target instanceof VariableElement) {
|
| - return findAncestor(target.getNode(), DartMethodDefinition.class);
|
| - } else if (target instanceof DartParameter) {
|
| - // TODO determine all decls that can have parameters and include here
|
| - return findAncestor(target.getNode(), DartMethodDefinition.class, DartFunction.class,
|
| - DartFunctionTypeAlias.class);
|
| - } else {
|
| - return ast;
|
| + if (target instanceof NodeElement) {
|
| + DartNode targetNode = ((NodeElement) target).getNode();
|
| + if (target instanceof VariableElement) {
|
| + return findAncestor(targetNode, DartMethodDefinition.class);
|
| + } else if (target instanceof DartParameter) {
|
| + // TODO determine all decls that can have parameters and include here
|
| + return findAncestor(targetNode, DartMethodDefinition.class, DartFunction.class,
|
| + DartFunctionTypeAlias.class);
|
| + }
|
| }
|
| + return ast;
|
| }
|
| }
|
|
|