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

Side by Side Diff: pkg/analysis_server/lib/src/search/element_references.dart

Issue 560553003: Avoid false positives when searching for uses of a constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library search.element_references; 5 library search.element_references;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/collections.dart'; 9 import 'package:analysis_server/src/collections.dart';
10 import 'package:analysis_server/src/protocol.dart' show SearchResult; 10 import 'package:analysis_server/src/protocol.dart' show SearchResult;
(...skipping 12 matching lines...) Expand all
23 ElementReferencesComputer(this.searchEngine); 23 ElementReferencesComputer(this.searchEngine);
24 24
25 /** 25 /**
26 * Computes [SearchResult]s for [element] references. 26 * Computes [SearchResult]s for [element] references.
27 */ 27 */
28 Future<List<SearchResult>> compute(Element element, bool withPotential) { 28 Future<List<SearchResult>> compute(Element element, bool withPotential) {
29 var futureGroup = new _ConcatFutureGroup<SearchResult>(); 29 var futureGroup = new _ConcatFutureGroup<SearchResult>();
30 // find element references 30 // find element references
31 futureGroup.add(_findElementsReferences(element)); 31 futureGroup.add(_findElementsReferences(element));
32 // add potential references 32 // add potential references
33 if (withPotential && _isMemberElement(element)) { 33 if (withPotential && _isMemberElement(element) &&
34 element is! ConstructorElement) {
scheglov 2014/09/09 20:45:17 Push this into _isMemberElement.
Paul Berry 2014/09/09 21:24:59 Done.
34 String name = element.displayName; 35 String name = element.displayName;
35 var matchesFuture = searchEngine.searchMemberReferences(name); 36 var matchesFuture = searchEngine.searchMemberReferences(name);
36 var resultsFuture = matchesFuture.then((List<SearchMatch> matches) { 37 var resultsFuture = matchesFuture.then((List<SearchMatch> matches) {
37 return matches.where((match) => !match.isResolved).map(toResult); 38 return matches.where((match) => !match.isResolved).map(toResult);
38 }); 39 });
39 futureGroup.add(resultsFuture); 40 futureGroup.add(resultsFuture);
40 } 41 }
41 // merge results 42 // merge results
42 return futureGroup.future; 43 return futureGroup.future;
43 } 44 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 * Adds a [Future] or an [E] value to results. 140 * Adds a [Future] or an [E] value to results.
140 */ 141 */
141 void add(value) { 142 void add(value) {
142 if (value is Future) { 143 if (value is Future) {
143 _futures.add(value); 144 _futures.add(value);
144 } else { 145 } else {
145 _futures.add(new Future.value(<E>[value])); 146 _futures.add(new Future.value(<E>[value]));
146 } 147 }
147 } 148 }
148 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698