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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // notification. | 144 // notification. |
145 return; | 145 return; |
146 } | 146 } |
147 server.prevAnalyzedFiles = analyzedFiles; | 147 server.prevAnalyzedFiles = analyzedFiles; |
148 protocol.AnalysisAnalyzedFilesParams params = | 148 protocol.AnalysisAnalyzedFilesParams params = |
149 new protocol.AnalysisAnalyzedFilesParams(analyzedFiles.toList()); | 149 new protocol.AnalysisAnalyzedFilesParams(analyzedFiles.toList()); |
150 server.sendNotification(params.toNotification()); | 150 server.sendNotification(params.toNotification()); |
151 }); | 151 }); |
152 } | 152 } |
153 | 153 |
154 void sendAnalysisNotificationErrors(AnalysisServer server, String file, | 154 void sendAnalysisNotificationErrors( |
155 LineInfo lineInfo, List<AnalysisError> errors) { | 155 AnalysisServer server, |
| 156 AnalysisContext context, |
| 157 String file, |
| 158 LineInfo lineInfo, |
| 159 List<AnalysisError> errors) { |
156 _sendNotification(server, () { | 160 _sendNotification(server, () { |
157 if (errors == null) { | 161 if (errors == null) { |
158 errors = <AnalysisError>[]; | 162 errors = <AnalysisError>[]; |
159 } | 163 } |
160 var serverErrors = | 164 var serverErrors = |
161 protocol.doAnalysisError_listFromEngine(lineInfo, errors); | 165 protocol.doAnalysisError_listFromEngine(context, lineInfo, errors); |
162 var params = new protocol.AnalysisErrorsParams(file, serverErrors); | 166 var params = new protocol.AnalysisErrorsParams(file, serverErrors); |
163 server.sendNotification(params.toNotification()); | 167 server.sendNotification(params.toNotification()); |
164 }); | 168 }); |
165 } | 169 } |
166 | 170 |
167 void sendAnalysisNotificationFlushResults( | 171 void sendAnalysisNotificationFlushResults( |
168 AnalysisServer server, List<String> files) { | 172 AnalysisServer server, List<String> files) { |
169 _sendNotification(server, () { | 173 _sendNotification(server, () { |
170 if (files != null && files.isNotEmpty) { | 174 if (files != null && files.isNotEmpty) { |
171 var params = new protocol.AnalysisFlushResultsParams(files); | 175 var params = new protocol.AnalysisFlushResultsParams(files); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 AnalysisContext context, String file, this.lineInfo, this.errors) | 511 AnalysisContext context, String file, this.lineInfo, this.errors) |
508 : super(context, file); | 512 : super(context, file); |
509 | 513 |
510 @override | 514 @override |
511 ServerOperationPriority get priority { | 515 ServerOperationPriority get priority { |
512 return ServerOperationPriority.ANALYSIS_NOTIFICATION; | 516 return ServerOperationPriority.ANALYSIS_NOTIFICATION; |
513 } | 517 } |
514 | 518 |
515 @override | 519 @override |
516 void perform(AnalysisServer server) { | 520 void perform(AnalysisServer server) { |
517 sendAnalysisNotificationErrors(server, file, lineInfo, errors); | 521 sendAnalysisNotificationErrors(server, context, file, lineInfo, errors); |
518 } | 522 } |
519 } | 523 } |
520 | 524 |
521 abstract class _NotificationOperation extends SourceSensitiveOperation { | 525 abstract class _NotificationOperation extends SourceSensitiveOperation { |
522 final Source source; | 526 final Source source; |
523 | 527 |
524 _NotificationOperation(AnalysisContext context, this.source) : super(context); | 528 _NotificationOperation(AnalysisContext context, this.source) : super(context); |
525 | 529 |
526 @override | 530 @override |
527 ServerOperationPriority get priority { | 531 ServerOperationPriority get priority { |
528 return ServerOperationPriority.ANALYSIS_NOTIFICATION; | 532 return ServerOperationPriority.ANALYSIS_NOTIFICATION; |
529 } | 533 } |
530 | 534 |
531 @override | 535 @override |
532 bool shouldBeDiscardedOnSourceChange(Source source) { | 536 bool shouldBeDiscardedOnSourceChange(Source source) { |
533 return source == this.source; | 537 return source == this.source; |
534 } | 538 } |
535 } | 539 } |
536 | 540 |
537 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 541 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
538 final String file; | 542 final String file; |
539 | 543 |
540 _SingleFileOperation(AnalysisContext context, this.file) : super(context); | 544 _SingleFileOperation(AnalysisContext context, this.file) : super(context); |
541 | 545 |
542 @override | 546 @override |
543 bool shouldBeDiscardedOnSourceChange(Source source) { | 547 bool shouldBeDiscardedOnSourceChange(Source source) { |
544 return source.fullName == file; | 548 return source.fullName == file; |
545 } | 549 } |
546 } | 550 } |
OLD | NEW |