| 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; | 5 library analyzer.src.plugin.options; |
| 6 | 6 |
| 7 import 'package:analyzer/plugin/options.dart'; | 7 import 'package:analyzer/plugin/options.dart'; |
| 8 import 'package:plugin/plugin.dart'; | 8 import 'package:plugin/plugin.dart'; |
| 9 | 9 |
| 10 /// A plugin that defines the extension points and extensions that are defined | 10 /// A plugin that defines the extension points and extensions that are defined |
| 11 /// by applications that want to consume options defined in the analysis | 11 /// by applications that want to consume options defined in the analysis |
| 12 /// options file. | 12 /// options file. |
| 13 class OptionsPlugin implements Plugin { | 13 class OptionsPlugin implements Plugin { |
| 14 | |
| 15 /// The simple identifier of the extension point that allows plugins to | 14 /// The simple identifier of the extension point that allows plugins to |
| 16 /// register new options processors. | 15 /// register new options processors. |
| 17 static const String OPTIONS_PROCESSOR_EXTENSION_POINT = 'optionsProcessor'; | 16 static const String OPTIONS_PROCESSOR_EXTENSION_POINT = 'optionsProcessor'; |
| 18 | 17 |
| 19 /// The unique identifier of this plugin. | 18 /// The unique identifier of this plugin. |
| 20 static const String UNIQUE_IDENTIFIER = 'options.core'; | 19 static const String UNIQUE_IDENTIFIER = 'options.core'; |
| 21 | 20 |
| 22 /// The extension point that allows plugins to register new options processors
. | 21 /// The extension point that allows plugins to register new options processors
. |
| 23 ExtensionPoint optionsProcessorExtensionPoint; | 22 ExtensionPoint optionsProcessorExtensionPoint; |
| 24 | 23 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 | 41 |
| 43 /// Validate the given extension by throwing an [ExtensionError] if it is not
a | 42 /// Validate the given extension by throwing an [ExtensionError] if it is not
a |
| 44 /// valid options processor. | 43 /// valid options processor. |
| 45 void _validateOptionsProcessorExtension(Object extension) { | 44 void _validateOptionsProcessorExtension(Object extension) { |
| 46 if (extension is! OptionsProcessor) { | 45 if (extension is! OptionsProcessor) { |
| 47 String id = optionsProcessorExtensionPoint.uniqueIdentifier; | 46 String id = optionsProcessorExtensionPoint.uniqueIdentifier; |
| 48 throw new ExtensionError('Extensions to $id must be an OptionsProcessor'); | 47 throw new ExtensionError('Extensions to $id must be an OptionsProcessor'); |
| 49 } | 48 } |
| 50 } | 49 } |
| 51 } | 50 } |
| OLD | NEW |