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

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

Issue 1095113003: Convert EnginePlugin.taskDescriptors into a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | 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/plugin.dart'; 7 import 'package:analyzer/plugin/plugin.dart';
8 import 'package:analyzer/plugin/task.dart'; 8 import 'package:analyzer/plugin/task.dart';
9 import 'package:analyzer/src/task/dart.dart'; 9 import 'package:analyzer/src/task/dart.dart';
10 import 'package:analyzer/src/task/general.dart'; 10 import 'package:analyzer/src/task/general.dart';
(...skipping 19 matching lines...) Expand all
30 * The extension point that allows plugins to register new analysis tasks with 30 * The extension point that allows plugins to register new analysis tasks with
31 * the analysis engine. 31 * the analysis engine.
32 */ 32 */
33 ExtensionPoint taskExtensionPoint; 33 ExtensionPoint taskExtensionPoint;
34 34
35 /** 35 /**
36 * Initialize a newly created plugin. 36 * Initialize a newly created plugin.
37 */ 37 */
38 EnginePlugin(); 38 EnginePlugin();
39 39
40 /**
41 * Return a list containing all of the task descriptors that were contributed.
42 */
43 List<TaskDescriptor> get taskDescriptors => taskExtensionPoint.extensions;
44
40 @override 45 @override
41 String get uniqueIdentifier => UNIQUE_IDENTIFIER; 46 String get uniqueIdentifier => UNIQUE_IDENTIFIER;
42 47
43 @override 48 @override
44 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { 49 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
45 taskExtensionPoint = 50 taskExtensionPoint =
46 registerExtensionPoint(TASK_EXTENSION_POINT, _validateTaskExtension); 51 registerExtensionPoint(TASK_EXTENSION_POINT, _validateTaskExtension);
47 } 52 }
48 53
49 @override 54 @override
(...skipping 26 matching lines...) Expand all
76 registerExtension(taskId, ResolveUnitTypeNamesTask.DESCRIPTOR); 81 registerExtension(taskId, ResolveUnitTypeNamesTask.DESCRIPTOR);
77 registerExtension(taskId, ResolveVariableReferencesTask.DESCRIPTOR); 82 registerExtension(taskId, ResolveVariableReferencesTask.DESCRIPTOR);
78 registerExtension(taskId, ScanDartTask.DESCRIPTOR); 83 registerExtension(taskId, ScanDartTask.DESCRIPTOR);
79 registerExtension(taskId, VerifyUnitTask.DESCRIPTOR); 84 registerExtension(taskId, VerifyUnitTask.DESCRIPTOR);
80 // 85 //
81 // Register HTML tasks. 86 // Register HTML tasks.
82 // 87 //
83 } 88 }
84 89
85 /** 90 /**
86 * Return a list containing all of the task descriptors that were contributed.
87 */
88 List<TaskDescriptor> taskDescriptors() {
89 return taskExtensionPoint.extensions;
90 }
91
92 /**
93 * Validate the given extension by throwing an [ExtensionError] if it is not a 91 * Validate the given extension by throwing an [ExtensionError] if it is not a
94 * valid domain. 92 * valid domain.
95 */ 93 */
96 void _validateTaskExtension(Object extension) { 94 void _validateTaskExtension(Object extension) {
97 if (extension is! TaskDescriptor) { 95 if (extension is! TaskDescriptor) {
98 String id = taskExtensionPoint.uniqueIdentifier; 96 String id = taskExtensionPoint.uniqueIdentifier;
99 throw new ExtensionError('Extensions to $id must be a TaskDescriptor'); 97 throw new ExtensionError('Extensions to $id must be a TaskDescriptor');
100 } 98 }
101 } 99 }
102 } 100 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698