Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Unified Diff: pkg/analysis_server/lib/src/search/element_references.dart

Issue 2518183003: Stop returning declaration matches from search for references. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/search/element_references_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/search/element_references.dart
diff --git a/pkg/analysis_server/lib/src/search/element_references.dart b/pkg/analysis_server/lib/src/search/element_references.dart
index 63d5280774fa7c19915c805fc5a96ab112c66209..476716e9693ae9cf8a2c95c307fb49d37514f004 100644
--- a/pkg/analysis_server/lib/src/search/element_references.dart
+++ b/pkg/analysis_server/lib/src/search/element_references.dart
@@ -10,9 +10,7 @@ import 'package:analysis_server/src/protocol_server.dart'
show SearchResult, newSearchResult_fromMatch;
import 'package:analysis_server/src/services/search/hierarchy.dart';
import 'package:analysis_server/src/services/search/search_engine.dart';
-import 'package:analysis_server/src/services/search/search_engine_internal.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/src/generated/source.dart';
/**
* A computer for `search.findElementReferences` request results.
@@ -52,12 +50,6 @@ class ElementReferencesComputer {
List<SearchResult> allResults = <SearchResult>[];
Iterable<Element> refElements = await _getRefElements(element);
for (Element refElement in refElements) {
- // add declaration
- if (_isDeclarationInteresting(refElement)) {
- SearchResult searchResult = _newDeclarationResult(refElement);
- allResults.add(searchResult);
- }
- // do search
List<SearchResult> elementResults =
await _findSingleElementReferences(refElement);
allResults.addAll(elementResults);
@@ -90,43 +82,10 @@ class ElementReferencesComputer {
return new Future.value([element]);
}
- SearchResult _newDeclarationResult(Element refElement) {
- int nameOffset = refElement.nameOffset;
- int nameLength = refElement.nameLength;
- SearchMatch searchMatch = new SearchMatchImpl(
- refElement.context,
- refElement.library.source.uri.toString(),
- refElement.source.uri.toString(),
- MatchKind.DECLARATION,
- new SourceRange(nameOffset, nameLength),
- true,
- false);
- return newSearchResult_fromMatch(searchMatch);
- }
-
static SearchResult toResult(SearchMatch match) {
return newSearchResult_fromMatch(match);
}
- static bool _isDeclarationInteresting(Element element) {
- if (element is LabelElement) {
- return true;
- }
- if (element is LocalVariableElement) {
- return true;
- }
- if (element is ParameterElement) {
- return true;
- }
- if (element is PrefixElement) {
- return true;
- }
- if (element is PropertyInducingElement) {
- return !element.isSynthetic;
- }
- return false;
- }
-
static bool _isMemberElement(Element element) {
if (element is ConstructorElement) {
return false;
« no previous file with comments | « no previous file | pkg/analysis_server/test/search/element_references_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698