Index: pkg/analyzer/lib/src/dart/analysis/search.dart |
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart |
index 3bdcdd17b10ccf1ac023c837c8c909c4153f5d1e..719f93db81925a2994ff30d68aa497367db72103 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart |
@@ -29,8 +29,17 @@ class Search { |
} |
ElementKind kind = element.kind; |
- if (kind == ElementKind.LABEL || kind == ElementKind.LOCAL_VARIABLE) { |
+ if (kind == ElementKind.FUNCTION || kind == ElementKind.METHOD) { |
+ if (element.enclosingElement is ExecutableElement) { |
+ return _searchReferences_Local(element, (n) => n is Block); |
+ } |
+// return _searchReferences_Function(element); |
+ } else if (kind == ElementKind.LABEL || |
+ kind == ElementKind.LOCAL_VARIABLE) { |
return _searchReferences_Local(element, (n) => n is Block); |
+ } else if (kind == ElementKind.TYPE_PARAMETER) { |
+ return _searchReferences_Local( |
+ element, (n) => n.parent is CompilationUnit); |
} |
// TODO(scheglov) support other kinds |
return const <SearchResult>[]; |
@@ -58,6 +67,9 @@ class Search { |
// Prepare the enclosing node. |
AstNode enclosingNode = node.getAncestor(isRootNode); |
+ if (enclosingNode == null) { |
+ return const <SearchResult>[]; |
+ } |
// Find the matches. |
_LocalReferencesVisitor visitor = |