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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 1487953002: Clean-up the registration of plugins (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 9be1f2d74a84f381e3e4dd6fe0982854fd0ea449..2769209ec272d8a3041481fe41212ef650354126 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -5925,11 +5925,6 @@ class AnalysisEngine {
InstrumentationService.NULL_SERVICE;
/**
- * The list of supported plugins for processing by clients.
- */
- List<Plugin> _supportedPlugins;
-
- /**
* The partition manager being used to manage the shared partitions.
*/
final PartitionManager partitionManager = new PartitionManager();
@@ -5953,11 +5948,6 @@ class AnalysisEngine {
bool limitInvalidationInTaskModel = false;
/**
- * The plugins that are defined outside the `analyzer` package.
- */
- List<Plugin> _userDefinedPlugins = <Plugin>[];
-
- /**
* The task manager used to manage the tasks used to analyze code.
*/
TaskManager _taskManager;
@@ -5997,26 +5987,21 @@ class AnalysisEngine {
}
/**
- * Return the list of supported plugins for processing by clients.
+ * Return the list of plugins that clients are required to process, either by
+ * creating an [ExtensionManager] or by using the method
+ * [processRequiredPlugins].
*/
- List<Plugin> get supportedPlugins {
- if (_supportedPlugins == null) {
- _supportedPlugins = <Plugin>[
- enginePlugin,
- commandLinePlugin,
- optionsPlugin
- ];
- _supportedPlugins.addAll(_userDefinedPlugins);
- }
- return _supportedPlugins;
- }
+ List<Plugin> get requiredPlugins => <Plugin>[enginePlugin];
/**
* Return the task manager used to manage the tasks used to analyze code.
*/
TaskManager get taskManager {
if (_taskManager == null) {
- new ExtensionManager().processPlugins(supportedPlugins);
+ if (enginePlugin.taskExtensionPoint == null) {
+ throw new IllegalStateException(
+ 'The analysis engine plugin has not been registered');
+ }
_taskManager = new TaskManager();
_taskManager.addTaskDescriptors(enginePlugin.taskDescriptors);
// TODO(brianwilkerson) Create a way to associate different results with
@@ -6027,18 +6012,6 @@ class AnalysisEngine {
}
/**
- * Set plugins that are defined outside the `analyzer` package.
- */
- void set userDefinedPlugins(List<Plugin> plugins) {
- if (plugins == null) {
- plugins = <Plugin>[];
- }
- _userDefinedPlugins = plugins;
- _supportedPlugins = null;
- _taskManager = null;
- }
-
- /**
* Clear any caches holding on to analysis results so that a full re-analysis
* will be performed the next time an analysis context is created.
*/
@@ -6057,6 +6030,16 @@ class AnalysisEngine {
}
/**
+ * A utility method that clients can use to process all of the required
+ * plugins. This method can only be used by clients that do not need to
+ * process any other plugins.
+ */
+ void processRequiredPlugins() {
+ ExtensionManager manager = new ExtensionManager();
+ manager.processPlugins(AnalysisEngine.instance.requiredPlugins);
+ }
+
+ /**
* Return `true` if the given [fileName] is an analysis options file.
*/
static bool isAnalysisOptionsFileName(String fileName,
« no previous file with comments | « pkg/analysis_server/test/services/correction/assist_test.dart ('k') | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698