OLD | NEW |
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 /** | 76 /** |
77 * Returns a [Future] completing with [Element]s to search references to. | 77 * Returns a [Future] completing with [Element]s to search references to. |
78 * | 78 * |
79 * If a [ClassMemberElement] is given, each corresponding [Element] in the | 79 * If a [ClassMemberElement] is given, each corresponding [Element] in the |
80 * hierarchy is returned. | 80 * hierarchy is returned. |
81 * | 81 * |
82 * Otherwise, only references to [element] should be searched. | 82 * Otherwise, only references to [element] should be searched. |
83 */ | 83 */ |
84 Future<Iterable<Element>> _getRefElements(Element element) { | 84 Future<Iterable<Element>> _getRefElements(Element element) { |
85 if (element is ClassMemberElement) { | 85 if (element is ClassMemberElement) { |
86 return getHierarchyMembers(searchEngine, element); | 86 return getHierarchyMembers(searchEngine, element, true); |
87 } | 87 } |
88 return new Future.value([element]); | 88 return new Future.value([element]); |
89 } | 89 } |
90 | 90 |
91 SearchResult _newDeclarationResult(Element refElement) { | 91 SearchResult _newDeclarationResult(Element refElement) { |
92 int nameOffset = refElement.nameOffset; | 92 int nameOffset = refElement.nameOffset; |
93 int nameLength = refElement.name.length; | 93 int nameLength = refElement.name.length; |
94 SearchMatch searchMatch = | 94 SearchMatch searchMatch = |
95 new SearchMatch( | 95 new SearchMatch( |
96 MatchKind.DECLARATION, | 96 MatchKind.DECLARATION, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 * Adds a [Future] or an [E] value to results. | 145 * Adds a [Future] or an [E] value to results. |
146 */ | 146 */ |
147 void add(value) { | 147 void add(value) { |
148 if (value is Future) { | 148 if (value is Future) { |
149 _futures.add(value); | 149 _futures.add(value); |
150 } else { | 150 } else { |
151 _futures.add(new Future.value(<E>[value])); | 151 _futures.add(new Future.value(<E>[value])); |
152 } | 152 } |
153 } | 153 } |
154 } | 154 } |
OLD | NEW |