Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: pkg/analyzer/lib/src/plugin/command_line_plugin.dart

Issue 1965083002: Update to use the latest version of the plugin package (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Patch version info Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('k') | pkg/analyzer/lib/src/plugin/engine_plugin.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.command_line_plugin; 5 library analyzer.src.plugin.command_line_plugin;
6 6
7 import 'package:analyzer/plugin/command_line.dart'; 7 import 'package:analyzer/plugin/command_line.dart';
8 import 'package:plugin/plugin.dart'; 8 import 'package:plugin/plugin.dart';
9 9
10 /** 10 /**
(...skipping 15 matching lines...) Expand all
26 26
27 /** 27 /**
28 * The unique identifier of this plugin. 28 * The unique identifier of this plugin.
29 */ 29 */
30 static const String UNIQUE_IDENTIFIER = 'command_line.core'; 30 static const String UNIQUE_IDENTIFIER = 'command_line.core';
31 31
32 /** 32 /**
33 * The extension point that allows plugins to register new parser 33 * The extension point that allows plugins to register new parser
34 * contributors. 34 * contributors.
35 */ 35 */
36 ExtensionPoint parserContributorExtensionPoint; 36 ExtensionPoint<ArgParserContributor> parserContributorExtensionPoint;
37 37
38 /** 38 /**
39 * The extension point that allows plugins to register new result processors. 39 * The extension point that allows plugins to register new result processors.
40 */ 40 */
41 ExtensionPoint resultProcessorExtensionPoint; 41 ExtensionPoint<ArgResultsProcessor> resultProcessorExtensionPoint;
42 42
43 /** 43 /**
44 * Initialize a newly created plugin. 44 * Initialize a newly created plugin.
45 */ 45 */
46 CommandLinePlugin(); 46 CommandLinePlugin();
47 47
48 /** 48 /**
49 * Return a list containing all of the parser contributors that were 49 * Return a list containing all of the parser contributors that were
50 * contributed. 50 * contributed.
51 */ 51 */
52 List<ArgParserContributor> get parserContributors => 52 List<ArgParserContributor> get parserContributors =>
53 parserContributorExtensionPoint.extensions; 53 parserContributorExtensionPoint.extensions;
54 54
55 /** 55 /**
56 * Return a list containing all of the result processors that were 56 * Return a list containing all of the result processors that were
57 * contributed. 57 * contributed.
58 */ 58 */
59 List<ArgResultsProcessor> get resultProcessors => 59 List<ArgResultsProcessor> get resultProcessors =>
60 resultProcessorExtensionPoint.extensions; 60 resultProcessorExtensionPoint.extensions;
61 61
62 @override 62 @override
63 String get uniqueIdentifier => UNIQUE_IDENTIFIER; 63 String get uniqueIdentifier => UNIQUE_IDENTIFIER;
64 64
65 @override 65 @override
66 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { 66 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
67 parserContributorExtensionPoint = registerExtensionPoint( 67 parserContributorExtensionPoint = new ExtensionPoint<ArgParserContributor>(
68 PARSER_CONTRIBUTOR_EXTENSION_POINT, 68 this, PARSER_CONTRIBUTOR_EXTENSION_POINT, null);
69 _validateParserContributorExtension); 69 registerExtensionPoint(parserContributorExtensionPoint);
70 resultProcessorExtensionPoint = registerExtensionPoint( 70 resultProcessorExtensionPoint = new ExtensionPoint<ArgResultsProcessor>(
71 RESULT_PROCESSOR_EXTENSION_POINT, _validateResultProcessorExtension); 71 this, RESULT_PROCESSOR_EXTENSION_POINT, null);
72 registerExtensionPoint(resultProcessorExtensionPoint);
72 } 73 }
73 74
74 @override 75 @override
75 void registerExtensions(RegisterExtension registerExtension) { 76 void registerExtensions(RegisterExtension registerExtension) {
76 // There are no default extensions. 77 // There are no default extensions.
77 } 78 }
78
79 /**
80 * Validate the given extension by throwing an [ExtensionError] if it is not a
81 * valid parser contributor.
82 */
83 void _validateParserContributorExtension(Object extension) {
84 if (extension is! ArgParserContributor) {
85 String id = parserContributorExtensionPoint.uniqueIdentifier;
86 throw new ExtensionError(
87 'Extensions to $id must be an ArgParserContributor');
88 }
89 }
90
91 /**
92 * Validate the given extension by throwing an [ExtensionError] if it is not a
93 * valid result processor.
94 */
95 void _validateResultProcessorExtension(Object extension) {
96 if (extension is! ArgResultsProcessor) {
97 String id = resultProcessorExtensionPoint.uniqueIdentifier;
98 throw new ExtensionError(
99 'Extensions to $id must be an ArgResultsProcessor');
100 }
101 }
102 } 79 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('k') | pkg/analyzer/lib/src/plugin/engine_plugin.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698