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_server.dart' | 10 import 'package:analysis_server/src/protocol_server.dart' |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
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.nameLength; | 93 int nameLength = refElement.nameLength; |
94 SearchMatch searchMatch = new SearchMatch(MatchKind.DECLARATION, refElement, | 94 SearchMatch searchMatch = new SearchMatch( |
95 new SourceRange(nameOffset, nameLength), true, false); | 95 refElement.context, |
| 96 refElement.library.source.uri.toString(), |
| 97 refElement.source.uri.toString(), |
| 98 MatchKind.DECLARATION, |
| 99 new SourceRange(nameOffset, nameLength), |
| 100 true, |
| 101 false); |
96 return newSearchResult_fromMatch(searchMatch); | 102 return newSearchResult_fromMatch(searchMatch); |
97 } | 103 } |
98 | 104 |
99 static SearchResult toResult(SearchMatch match) { | 105 static SearchResult toResult(SearchMatch match) { |
100 return newSearchResult_fromMatch(match); | 106 return newSearchResult_fromMatch(match); |
101 } | 107 } |
102 | 108 |
103 static bool _isDeclarationInteresting(Element element) { | 109 static bool _isDeclarationInteresting(Element element) { |
104 if (element is LabelElement) { | 110 if (element is LabelElement) { |
105 return true; | 111 return true; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 * Adds a [Future] or an [E] value to results. | 148 * Adds a [Future] or an [E] value to results. |
143 */ | 149 */ |
144 void add(value) { | 150 void add(value) { |
145 if (value is Future) { | 151 if (value is Future) { |
146 _futures.add(value); | 152 _futures.add(value); |
147 } else { | 153 } else { |
148 _futures.add(new Future.value(<E>[value])); | 154 _futures.add(new Future.value(<E>[value])); |
149 } | 155 } |
150 } | 156 } |
151 } | 157 } |
OLD | NEW |