| 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.domain; | 5 library search.domain; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
| 9 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 9 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
| 10 import 'package:analysis_server/src/search/element_references.dart'; | 10 import 'package:analysis_server/src/search/element_references.dart'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 if (element is ImportElement) { | 49 if (element is ImportElement) { |
| 50 return element.prefix; | 50 return element.prefix; |
| 51 } | 51 } |
| 52 if (element is FieldFormalParameterElement) { | 52 if (element is FieldFormalParameterElement) { |
| 53 return element.field; | 53 return element.field; |
| 54 } | 54 } |
| 55 if (element is PropertyAccessorElement) { | 55 if (element is PropertyAccessorElement) { |
| 56 return element.variable; | 56 return element.variable; |
| 57 } | 57 } |
| 58 return element; | 58 return element; |
| 59 }).where((Element element) { |
| 60 return element != null; |
| 59 }).toList(); | 61 }).toList(); |
| 60 // schedule search | 62 // schedule search |
| 61 String searchId = (_nextSearchId++).toString(); | 63 String searchId = (_nextSearchId++).toString(); |
| 62 elements.forEach((Element element) { | 64 elements.forEach((Element element) { |
| 63 var computer = new ElementReferencesComputer(searchEngine); | 65 var computer = new ElementReferencesComputer(searchEngine); |
| 64 var future = computer.compute(element, params.includePotential); | 66 var future = computer.compute(element, params.includePotential); |
| 65 future.then((List<protocol.SearchResult> results) { | 67 future.then((List<protocol.SearchResult> results) { |
| 66 bool isLast = identical(element, elements.last); | 68 bool isLast = identical(element, elements.last); |
| 67 _sendSearchNotification(searchId, isLast, results); | 69 _sendSearchNotification(searchId, isLast, results); |
| 68 }); | 70 }); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 new protocol.SearchResultsParams( | 180 new protocol.SearchResultsParams( |
| 179 searchId, | 181 searchId, |
| 180 results.toList(), | 182 results.toList(), |
| 181 isLast).toNotification()); | 183 isLast).toNotification()); |
| 182 } | 184 } |
| 183 | 185 |
| 184 static protocol.SearchResult toResult(SearchMatch match) { | 186 static protocol.SearchResult toResult(SearchMatch match) { |
| 185 return protocol.newSearchResult_fromMatch(match); | 187 return protocol.newSearchResult_fromMatch(match); |
| 186 } | 188 } |
| 187 } | 189 } |
| OLD | NEW |