| 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_highlights2.dart'; | 9 import 'package:analysis_server/src/computer/computer_highlights2.dart'; |
| 10 import 'package:analysis_server/src/computer/computer_outline.dart'; | 10 import 'package:analysis_server/src/computer/computer_outline.dart'; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 269 } |
| 270 | 270 |
| 271 /** | 271 /** |
| 272 * Runs the given notification producing function [f], catching exceptions. | 272 * Runs the given notification producing function [f], catching exceptions. |
| 273 */ | 273 */ |
| 274 void _sendNotification(AnalysisServer server, f()) { | 274 void _sendNotification(AnalysisServer server, f()) { |
| 275 ServerPerformanceStatistics.notices.makeCurrentWhile(() { | 275 ServerPerformanceStatistics.notices.makeCurrentWhile(() { |
| 276 try { | 276 try { |
| 277 f(); | 277 f(); |
| 278 } catch (exception, stackTrace) { | 278 } catch (exception, stackTrace) { |
| 279 server.sendServerErrorNotification(exception, stackTrace); | 279 server.sendServerErrorNotification(null, exception, stackTrace); |
| 280 } | 280 } |
| 281 }); | 281 }); |
| 282 } | 282 } |
| 283 | 283 |
| 284 class NavigationOperation extends _NotificationOperation | 284 class NavigationOperation extends _NotificationOperation |
| 285 implements MergeableOperation { | 285 implements MergeableOperation { |
| 286 NavigationOperation(AnalysisContext context, Source source) | 286 NavigationOperation(AnalysisContext context, Source source) |
| 287 : super(context, source); | 287 : super(context, source); |
| 288 | 288 |
| 289 @override | 289 @override |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } | 411 } |
| 412 for (ChangeNotice notice in notices) { | 412 for (ChangeNotice notice in notices) { |
| 413 String file = notice.source.fullName; | 413 String file = notice.source.fullName; |
| 414 // Dart | 414 // Dart |
| 415 try { | 415 try { |
| 416 CompilationUnit dartUnit = notice.resolvedDartUnit; | 416 CompilationUnit dartUnit = notice.resolvedDartUnit; |
| 417 if (dartUnit != null) { | 417 if (dartUnit != null) { |
| 418 scheduleIndexOperation(server, file, dartUnit); | 418 scheduleIndexOperation(server, file, dartUnit); |
| 419 } | 419 } |
| 420 } catch (exception, stackTrace) { | 420 } catch (exception, stackTrace) { |
| 421 server.sendServerErrorNotification(exception, stackTrace); | 421 server.sendServerErrorNotification(null, exception, stackTrace); |
| 422 } | 422 } |
| 423 // HTML | 423 // HTML |
| 424 try { | 424 try { |
| 425 HtmlUnit htmlUnit = notice.resolvedHtmlUnit; | 425 HtmlUnit htmlUnit = notice.resolvedHtmlUnit; |
| 426 if (htmlUnit != null) { | 426 if (htmlUnit != null) { |
| 427 server.addOperation(new _HtmlIndexOperation(context, file, htmlUnit)); | 427 server.addOperation(new _HtmlIndexOperation(context, file, htmlUnit)); |
| 428 } | 428 } |
| 429 } catch (exception, stackTrace) { | 429 } catch (exception, stackTrace) { |
| 430 server.sendServerErrorNotification(exception, stackTrace); | 430 server.sendServerErrorNotification(null, exception, stackTrace); |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 | 435 |
| 436 class _DartHighlightsOperation extends _DartNotificationOperation { | 436 class _DartHighlightsOperation extends _DartNotificationOperation { |
| 437 _DartHighlightsOperation( | 437 _DartHighlightsOperation( |
| 438 AnalysisContext context, String file, CompilationUnit unit) | 438 AnalysisContext context, String file, CompilationUnit unit) |
| 439 : super(context, file, unit); | 439 : super(context, file, unit); |
| 440 | 440 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 456 } | 456 } |
| 457 | 457 |
| 458 @override | 458 @override |
| 459 void perform(AnalysisServer server) { | 459 void perform(AnalysisServer server) { |
| 460 ServerPerformanceStatistics.indexOperation.makeCurrentWhile(() { | 460 ServerPerformanceStatistics.indexOperation.makeCurrentWhile(() { |
| 461 try { | 461 try { |
| 462 Index index = server.index; | 462 Index index = server.index; |
| 463 AnalysisContext context = unit.element.context; | 463 AnalysisContext context = unit.element.context; |
| 464 index.index(context, unit); | 464 index.index(context, unit); |
| 465 } catch (exception, stackTrace) { | 465 } catch (exception, stackTrace) { |
| 466 server.sendServerErrorNotification(exception, stackTrace); | 466 server.sendServerErrorNotification(null, exception, stackTrace); |
| 467 } | 467 } |
| 468 }); | 468 }); |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 | 471 |
| 472 abstract class _DartNotificationOperation extends _SingleFileOperation { | 472 abstract class _DartNotificationOperation extends _SingleFileOperation { |
| 473 final CompilationUnit unit; | 473 final CompilationUnit unit; |
| 474 | 474 |
| 475 _DartNotificationOperation(AnalysisContext context, String file, this.unit) | 475 _DartNotificationOperation(AnalysisContext context, String file, this.unit) |
| 476 : super(context, file); | 476 : super(context, file); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 562 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
| 563 final String file; | 563 final String file; |
| 564 | 564 |
| 565 _SingleFileOperation(AnalysisContext context, this.file) : super(context); | 565 _SingleFileOperation(AnalysisContext context, this.file) : super(context); |
| 566 | 566 |
| 567 @override | 567 @override |
| 568 bool shouldBeDiscardedOnSourceChange(Source source) { | 568 bool shouldBeDiscardedOnSourceChange(Source source) { |
| 569 return source.fullName == file; | 569 return source.fullName == file; |
| 570 } | 570 } |
| 571 } | 571 } |
| OLD | NEW |