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 operation.analysis; | 5 library operation.analysis; |
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/computer/computer_highlights.dart'; | 8 import 'package:analysis_server/src/computer/computer_highlights.dart'; |
9 import 'package:analysis_server/src/computer/computer_navigation.dart'; | 9 import 'package:analysis_server/src/computer/computer_navigation.dart'; |
10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; | 10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 /** | 168 /** |
169 * Send the information in the given list of notices back to the client. | 169 * Send the information in the given list of notices back to the client. |
170 */ | 170 */ |
171 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { | 171 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { |
172 for (int i = 0; i < notices.length; i++) { | 172 for (int i = 0; i < notices.length; i++) { |
173 ChangeNotice notice = notices[i]; | 173 ChangeNotice notice = notices[i]; |
174 Source source = notice.source; | 174 Source source = notice.source; |
175 String file = source.fullName; | 175 String file = source.fullName; |
176 // Dart | 176 // Dart |
177 CompilationUnit parsedDartUnit = notice.parsedDartUnit; | 177 CompilationUnit parsedDartUnit = notice.parsedDartUnit; |
178 CompilationUnit resolvedDartUnit = notice.compilationUnit; | 178 CompilationUnit resolvedDartUnit = notice.resolvedDartUnit; |
179 CompilationUnit dartUnit = | 179 CompilationUnit dartUnit = |
180 resolvedDartUnit != null ? resolvedDartUnit : parsedDartUnit; | 180 resolvedDartUnit != null ? resolvedDartUnit : parsedDartUnit; |
181 if (resolvedDartUnit != null) { | 181 if (resolvedDartUnit != null) { |
182 if (server.hasAnalysisSubscription( | 182 if (server.hasAnalysisSubscription( |
183 protocol.AnalysisService.HIGHLIGHTS, | 183 protocol.AnalysisService.HIGHLIGHTS, |
184 file)) { | 184 file)) { |
185 server.addOperation( | 185 server.addOperation( |
186 new _DartHighlightsOperation(file, resolvedDartUnit)); | 186 new _DartHighlightsOperation(file, resolvedDartUnit)); |
187 } | 187 } |
188 if (server.hasAnalysisSubscription( | 188 if (server.hasAnalysisSubscription( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 | 232 |
233 void _updateIndex(AnalysisServer server, List<ChangeNotice> notices) { | 233 void _updateIndex(AnalysisServer server, List<ChangeNotice> notices) { |
234 Index index = server.index; | 234 Index index = server.index; |
235 if (index == null) { | 235 if (index == null) { |
236 return; | 236 return; |
237 } | 237 } |
238 for (ChangeNotice notice in notices) { | 238 for (ChangeNotice notice in notices) { |
239 // Dart | 239 // Dart |
240 try { | 240 try { |
241 CompilationUnit dartUnit = notice.compilationUnit; | 241 CompilationUnit dartUnit = notice.resolvedDartUnit; |
242 if (dartUnit != null) { | 242 if (dartUnit != null) { |
243 server.addOperation(new _DartIndexOperation(context, dartUnit)); | 243 server.addOperation(new _DartIndexOperation(context, dartUnit)); |
244 } | 244 } |
245 } catch (exception, stackTrace) { | 245 } catch (exception, stackTrace) { |
246 server.sendServerErrorNotification(exception, stackTrace); | 246 server.sendServerErrorNotification(exception, stackTrace); |
247 } | 247 } |
248 // HTML | 248 // HTML |
249 try { | 249 try { |
250 HtmlUnit htmlUnit = notice.htmlUnit; | 250 HtmlUnit htmlUnit = notice.resolvedHtmlUnit; |
251 if (htmlUnit != null) { | 251 if (htmlUnit != null) { |
252 server.addOperation(new _HtmlIndexOperation(context, htmlUnit)); | 252 server.addOperation(new _HtmlIndexOperation(context, htmlUnit)); |
253 } | 253 } |
254 } catch (exception, stackTrace) { | 254 } catch (exception, stackTrace) { |
255 server.sendServerErrorNotification(exception, stackTrace); | 255 server.sendServerErrorNotification(exception, stackTrace); |
256 } | 256 } |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 @override | 377 @override |
378 ServerOperationPriority get priority { | 378 ServerOperationPriority get priority { |
379 return ServerOperationPriority.ANALYSIS_NOTIFICATION; | 379 return ServerOperationPriority.ANALYSIS_NOTIFICATION; |
380 } | 380 } |
381 | 381 |
382 @override | 382 @override |
383 void perform(AnalysisServer server) { | 383 void perform(AnalysisServer server) { |
384 sendAnalysisNotificationErrors(server, file, lineInfo, errors); | 384 sendAnalysisNotificationErrors(server, file, lineInfo, errors); |
385 } | 385 } |
386 } | 386 } |
OLD | NEW |