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

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

Issue 1401543002: Create a breadcrumb trail for analyzing of task model extensions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | 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.engine_plugin; 5 library analyzer.src.plugin.engine_plugin;
6 6
7 import 'package:analyzer/plugin/task.dart'; 7 import 'package:analyzer/plugin/task.dart';
8 import 'package:analyzer/src/generated/engine.dart' 8 import 'package:analyzer/src/generated/engine.dart'
9 show InternalAnalysisContext; 9 show InternalAnalysisContext;
10 import 'package:analyzer/src/generated/error.dart' show AnalysisError; 10 import 'package:analyzer/src/generated/error.dart' show AnalysisError;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 /** 93 /**
94 * Initialize a newly created plugin. 94 * Initialize a newly created plugin.
95 */ 95 */
96 EnginePlugin(); 96 EnginePlugin();
97 97
98 /** 98 /**
99 * Return a list containing all of the contributed analysis error result 99 * Return a list containing all of the contributed analysis error result
100 * descriptors for Dart sources. 100 * descriptors for Dart sources.
101 */ 101 */
102 @ExtensionPointId('DART_ERRORS_FOR_SOURCE_EXTENSION_POINT_ID')
102 List<TaskDescriptor> get dartErrorsForSource => 103 List<TaskDescriptor> get dartErrorsForSource =>
103 dartErrorsForSourceExtensionPoint.extensions; 104 dartErrorsForSourceExtensionPoint.extensions;
104 105
105 /** 106 /**
106 * Return a list containing all of the contributed analysis error result 107 * Return a list containing all of the contributed analysis error result
107 * descriptors for Dart library specific units. 108 * descriptors for Dart library specific units.
108 */ 109 */
110 @ExtensionPointId('DART_ERRORS_FOR_UNIT_EXTENSION_POINT_ID')
109 List<TaskDescriptor> get dartErrorsForUnit => 111 List<TaskDescriptor> get dartErrorsForUnit =>
110 dartErrorsForUnitExtensionPoint.extensions; 112 dartErrorsForUnitExtensionPoint.extensions;
111 113
112 /** 114 /**
113 * Return a list containing all of the contributed analysis error result 115 * Return a list containing all of the contributed analysis error result
114 * descriptors for HTML sources. 116 * descriptors for HTML sources.
115 */ 117 */
118 @ExtensionPointId('HTML_ERRORS_EXTENSION_POINT_ID')
116 List<TaskDescriptor> get htmlErrors => htmlErrorsExtensionPoint.extensions; 119 List<TaskDescriptor> get htmlErrors => htmlErrorsExtensionPoint.extensions;
117 120
118 /** 121 /**
119 * Return a list containing all of the task descriptors that were contributed. 122 * Return a list containing all of the task descriptors that were contributed.
120 */ 123 */
121 List<TaskDescriptor> get taskDescriptors => taskExtensionPoint.extensions; 124 List<TaskDescriptor> get taskDescriptors => taskExtensionPoint.extensions;
122 125
123 @override 126 @override
124 String get uniqueIdentifier => UNIQUE_IDENTIFIER; 127 String get uniqueIdentifier => UNIQUE_IDENTIFIER;
125 128
(...skipping 25 matching lines...) Expand all
151 @override 154 @override
152 void registerExtensions(RegisterExtension registerExtension) { 155 void registerExtensions(RegisterExtension registerExtension) {
153 _registerTaskExtensions(registerExtension); 156 _registerTaskExtensions(registerExtension);
154 _registerWorkManagerFactoryExtensions(registerExtension); 157 _registerWorkManagerFactoryExtensions(registerExtension);
155 _registerDartErrorsForSource(registerExtension); 158 _registerDartErrorsForSource(registerExtension);
156 _registerDartErrorsForUnit(registerExtension); 159 _registerDartErrorsForUnit(registerExtension);
157 _registerHtmlErrors(registerExtension); 160 _registerHtmlErrors(registerExtension);
158 } 161 }
159 162
160 void _registerDartErrorsForSource(RegisterExtension registerExtension) { 163 void _registerDartErrorsForSource(RegisterExtension registerExtension) {
161 String id = DART_ERRORS_FOR_SOURCE_EXTENSION_POINT_ID; 164 registerExtension(DART_ERRORS_FOR_SOURCE_EXTENSION_POINT_ID, PARSE_ERRORS);
162 registerExtension(id, PARSE_ERRORS); 165 registerExtension(DART_ERRORS_FOR_SOURCE_EXTENSION_POINT_ID, SCAN_ERRORS);
163 registerExtension(id, SCAN_ERRORS);
164 } 166 }
165 167
166 void _registerDartErrorsForUnit(RegisterExtension registerExtension) { 168 void _registerDartErrorsForUnit(RegisterExtension registerExtension) {
167 String id = DART_ERRORS_FOR_UNIT_EXTENSION_POINT_ID; 169 registerExtension(
168 registerExtension(id, LIBRARY_UNIT_ERRORS); 170 DART_ERRORS_FOR_UNIT_EXTENSION_POINT_ID, LIBRARY_UNIT_ERRORS);
169 } 171 }
170 172
171 void _registerHtmlErrors(RegisterExtension registerExtension) { 173 void _registerHtmlErrors(RegisterExtension registerExtension) {
172 String id = HTML_ERRORS_EXTENSION_POINT_ID; 174 registerExtension(HTML_ERRORS_EXTENSION_POINT_ID, HTML_DOCUMENT_ERRORS);
173 registerExtension(id, HTML_DOCUMENT_ERRORS);
174 } 175 }
175 176
176 void _registerTaskExtensions(RegisterExtension registerExtension) { 177 void _registerTaskExtensions(RegisterExtension registerExtension) {
177 String taskId = TASK_EXTENSION_POINT_ID; 178 String taskId = TASK_EXTENSION_POINT_ID;
178 // 179 //
179 // Register general tasks. 180 // Register general tasks.
180 // 181 //
181 registerExtension(taskId, GetContentTask.DESCRIPTOR); 182 registerExtension(taskId, GetContentTask.DESCRIPTOR);
182 // 183 //
183 // Register Dart tasks. 184 // Register Dart tasks.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 * a [WorkManagerFactory]. 264 * a [WorkManagerFactory].
264 */ 265 */
265 void _validateWorkManagerFactoryExtension(Object extension) { 266 void _validateWorkManagerFactoryExtension(Object extension) {
266 if (extension is! WorkManagerFactory) { 267 if (extension is! WorkManagerFactory) {
267 String id = taskExtensionPoint.uniqueIdentifier; 268 String id = taskExtensionPoint.uniqueIdentifier;
268 throw new ExtensionError( 269 throw new ExtensionError(
269 'Extensions to $id must be a WorkManagerFactory'); 270 'Extensions to $id must be a WorkManagerFactory');
270 } 271 }
271 } 272 }
272 } 273 }
274
275 /**
276 * Annotation describing the relationship between a getter in [EnginePlugin]
277 * and the associated identifier (in '../../plugin/task.dart') which can be
278 * passed to the extension manager to populate it.
279 *
280 * This annotation is not used at runtime; it is used to aid in static analysis
281 * of the task model during development.
282 */
283 class ExtensionPointId {
284 final String extensionPointId;
285
286 const ExtensionPointId(this.extensionPointId);
287 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698