| 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; | 5 library operation; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | |
| 9 | 8 |
| 10 | 9 |
| 11 /** | 10 /** |
| 12 * The enumeration [ServerOperationPriority] defines the priority levels used | 11 * The enumeration [ServerOperationPriority] defines the priority levels used |
| 13 * to organize [ServerOperation]s in an optimal order. A smaller ordinal value | 12 * to organize [ServerOperation]s in an optimal order. A smaller ordinal value |
| 14 * equates to a higher priority. | 13 * equates to a higher priority. |
| 15 */ | 14 */ |
| 16 class ServerOperationPriority { | 15 class ServerOperationPriority { |
| 17 final int ordinal; | 16 final int ordinal; |
| 18 final String name; | 17 final String name; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 39 /** | 38 /** |
| 40 * Returns the priority of this operation. | 39 * Returns the priority of this operation. |
| 41 */ | 40 */ |
| 42 ServerOperationPriority get priority; | 41 ServerOperationPriority get priority; |
| 43 | 42 |
| 44 /** | 43 /** |
| 45 * Performs the operation implemented by this operation. | 44 * Performs the operation implemented by this operation. |
| 46 */ | 45 */ |
| 47 void perform(AnalysisServer server); | 46 void perform(AnalysisServer server); |
| 48 } | 47 } |
| 49 | |
| 50 | |
| 51 /** | |
| 52 * Instances of [PerformAnalysisOperation] perform a single analysis task. | |
| 53 */ | |
| 54 class PerformAnalysisOperation extends ServerOperation { | |
| 55 final AnalysisContext context; | |
| 56 final bool isContinue; | |
| 57 | |
| 58 PerformAnalysisOperation(this.context, this.isContinue); | |
| 59 | |
| 60 @override | |
| 61 ServerOperationPriority get priority { | |
| 62 if (isContinue) { | |
| 63 return ServerOperationPriority.ANALYSIS_CONTINUE; | |
| 64 } else { | |
| 65 return ServerOperationPriority.ANALYSIS; | |
| 66 } | |
| 67 } | |
| 68 | |
| 69 @override | |
| 70 void perform(AnalysisServer server) { | |
| 71 server.internalPerformAnalysis(context); | |
| 72 } | |
| 73 } | |
| OLD | NEW |