| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.src.plugin.options_plugin; | 5 library analyzer.src.plugin.options_plugin; |
| 6 | 6 |
| 7 import 'package:analyzer/plugin/options.dart'; | 7 import 'package:analyzer/plugin/options.dart'; |
| 8 import 'package:analyzer/plugin/task.dart'; | 8 import 'package:analyzer/plugin/task.dart'; |
| 9 import 'package:analyzer/src/task/options.dart'; | 9 import 'package:analyzer/src/task/options.dart'; |
| 10 import 'package:plugin/plugin.dart'; | 10 import 'package:plugin/plugin.dart'; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 /// The extension point that allows plugins to register new options | 27 /// The extension point that allows plugins to register new options |
| 28 /// processors. | 28 /// processors. |
| 29 ExtensionPoint optionsProcessorExtensionPoint; | 29 ExtensionPoint optionsProcessorExtensionPoint; |
| 30 | 30 |
| 31 /// The extension point that allows plugins to register new options | 31 /// The extension point that allows plugins to register new options |
| 32 /// validators. | 32 /// validators. |
| 33 ExtensionPoint optionsValidatorExtensionPoint; | 33 ExtensionPoint optionsValidatorExtensionPoint; |
| 34 | 34 |
| 35 /// All contributed options processors. | 35 /// All contributed options processors. |
| 36 List<OptionsProcessor> get optionsProcessors => | 36 List<OptionsProcessor> get optionsProcessors => |
| 37 optionsProcessorExtensionPoint?.extensions ?? const []; | 37 optionsProcessorExtensionPoint?.extensions as List<OptionsProcessor> ?? |
| 38 const <OptionsProcessor>[]; |
| 38 | 39 |
| 39 /// All contributed options validators. | 40 /// All contributed options validators. |
| 40 List<OptionsValidator> get optionsValidators => | 41 List<OptionsValidator> get optionsValidators => |
| 41 optionsValidatorExtensionPoint?.extensions ?? const []; | 42 optionsValidatorExtensionPoint?.extensions as List<OptionsValidator> ?? |
| 43 const <OptionsValidator>[]; |
| 42 | 44 |
| 43 @override | 45 @override |
| 44 String get uniqueIdentifier => UNIQUE_IDENTIFIER; | 46 String get uniqueIdentifier => UNIQUE_IDENTIFIER; |
| 45 | 47 |
| 46 @override | 48 @override |
| 47 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { | 49 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { |
| 48 optionsProcessorExtensionPoint = registerExtensionPoint( | 50 optionsProcessorExtensionPoint = registerExtensionPoint( |
| 49 OPTIONS_PROCESSOR_EXTENSION_POINT, _validateOptionsProcessorExtension); | 51 OPTIONS_PROCESSOR_EXTENSION_POINT, _validateOptionsProcessorExtension); |
| 50 optionsValidatorExtensionPoint = registerExtensionPoint( | 52 optionsValidatorExtensionPoint = registerExtensionPoint( |
| 51 OPTIONS_VALIDATOR_EXTENSION_POINT, _validateOptionsValidatorExtension); | 53 OPTIONS_VALIDATOR_EXTENSION_POINT, _validateOptionsValidatorExtension); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 72 | 74 |
| 73 /// Validate the given extension by throwing an [ExtensionError] if it is not | 75 /// Validate the given extension by throwing an [ExtensionError] if it is not |
| 74 /// a valid options validator. | 76 /// a valid options validator. |
| 75 void _validateOptionsValidatorExtension(Object extension) { | 77 void _validateOptionsValidatorExtension(Object extension) { |
| 76 if (extension is! OptionsValidator) { | 78 if (extension is! OptionsValidator) { |
| 77 String id = optionsValidatorExtensionPoint.uniqueIdentifier; | 79 String id = optionsValidatorExtensionPoint.uniqueIdentifier; |
| 78 throw new ExtensionError('Extensions to $id must be an OptionsValidator'); | 80 throw new ExtensionError('Extensions to $id must be an OptionsValidator'); |
| 79 } | 81 } |
| 80 } | 82 } |
| 81 } | 83 } |
| OLD | NEW |