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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 1460123002: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 engine; 5 library engine;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:math' as math; 9 import 'dart:math' as math;
10 10
(...skipping 5907 matching lines...) Expand 10 before | Expand all | Expand 10 after
5918 */ 5918 */
5919 final OptionsPlugin optionsPlugin = new OptionsPlugin(); 5919 final OptionsPlugin optionsPlugin = new OptionsPlugin();
5920 5920
5921 /** 5921 /**
5922 * The instrumentation service that is to be used by this analysis engine. 5922 * The instrumentation service that is to be used by this analysis engine.
5923 */ 5923 */
5924 InstrumentationService _instrumentationService = 5924 InstrumentationService _instrumentationService =
5925 InstrumentationService.NULL_SERVICE; 5925 InstrumentationService.NULL_SERVICE;
5926 5926
5927 /** 5927 /**
5928 * The list of supported plugins for processing by clients.
5929 */
5930 List<Plugin> _supportedPlugins;
5931
5932 /**
5933 * The partition manager being used to manage the shared partitions. 5928 * The partition manager being used to manage the shared partitions.
5934 */ 5929 */
5935 final PartitionManager partitionManager = new PartitionManager(); 5930 final PartitionManager partitionManager = new PartitionManager();
5936 5931
5937 /** 5932 /**
5938 * The partition manager being used to manage the shared partitions. 5933 * The partition manager being used to manage the shared partitions.
5939 */ 5934 */
5940 final newContext.PartitionManager partitionManager_new = 5935 final newContext.PartitionManager partitionManager_new =
5941 new newContext.PartitionManager(); 5936 new newContext.PartitionManager();
5942 5937
5943 /** 5938 /**
5944 * A flag indicating whether the (new) task model should be used to perform 5939 * A flag indicating whether the (new) task model should be used to perform
5945 * analysis. 5940 * analysis.
5946 */ 5941 */
5947 bool useTaskModel = true; 5942 bool useTaskModel = true;
5948 5943
5949 /** 5944 /**
5950 * A flag indicating whether the task model should attempt to limit 5945 * A flag indicating whether the task model should attempt to limit
5951 * invalidation after a change. 5946 * invalidation after a change.
5952 */ 5947 */
5953 bool limitInvalidationInTaskModel = false; 5948 bool limitInvalidationInTaskModel = false;
5954 5949
5955 /** 5950 /**
5956 * The plugins that are defined outside the `analyzer` package.
5957 */
5958 List<Plugin> _userDefinedPlugins = <Plugin>[];
5959
5960 /**
5961 * The task manager used to manage the tasks used to analyze code. 5951 * The task manager used to manage the tasks used to analyze code.
5962 */ 5952 */
5963 TaskManager _taskManager; 5953 TaskManager _taskManager;
5964 5954
5965 AnalysisEngine._(); 5955 AnalysisEngine._();
5966 5956
5967 /** 5957 /**
5968 * Return the instrumentation service that is to be used by this analysis 5958 * Return the instrumentation service that is to be used by this analysis
5969 * engine. 5959 * engine.
5970 */ 5960 */
(...skipping 22 matching lines...) Expand all
5993 * analysis engine to the given [logger]. 5983 * analysis engine to the given [logger].
5994 */ 5984 */
5995 void set logger(Logger logger) { 5985 void set logger(Logger logger) {
5996 this._logger = logger == null ? Logger.NULL : logger; 5986 this._logger = logger == null ? Logger.NULL : logger;
5997 } 5987 }
5998 5988
5999 /** 5989 /**
6000 * Return the list of supported plugins for processing by clients. 5990 * Return the list of supported plugins for processing by clients.
6001 */ 5991 */
6002 List<Plugin> get supportedPlugins { 5992 List<Plugin> get supportedPlugins {
6003 if (_supportedPlugins == null) { 5993 return <Plugin>[enginePlugin, commandLinePlugin, optionsPlugin];
pquitslund 2015/11/20 04:34:09 Is there any reason not to cache this in a const l
Brian Wilkerson 2015/11/20 14:23:17 No, but I expect each client to call this method e
6004 _supportedPlugins = <Plugin>[
6005 enginePlugin,
6006 commandLinePlugin,
6007 optionsPlugin
6008 ];
6009 _supportedPlugins.addAll(_userDefinedPlugins);
6010 }
6011 return _supportedPlugins;
6012 } 5994 }
6013 5995
6014 /** 5996 /**
6015 * Return the task manager used to manage the tasks used to analyze code. 5997 * Return the task manager used to manage the tasks used to analyze code.
6016 */ 5998 */
6017 TaskManager get taskManager { 5999 TaskManager get taskManager {
6018 if (_taskManager == null) { 6000 if (_taskManager == null) {
6019 new ExtensionManager().processPlugins(supportedPlugins); 6001 if (enginePlugin.taskExtensionPoint == null) {
6002 throw new IllegalStateException(
6003 'The analysis engine plugin has not been registered');
6004 }
6020 _taskManager = new TaskManager(); 6005 _taskManager = new TaskManager();
6021 _taskManager.addTaskDescriptors(enginePlugin.taskDescriptors); 6006 _taskManager.addTaskDescriptors(enginePlugin.taskDescriptors);
6022 // TODO(brianwilkerson) Create a way to associate different results with 6007 // TODO(brianwilkerson) Create a way to associate different results with
6023 // different file suffixes, then make this pluggable. 6008 // different file suffixes, then make this pluggable.
6024 _taskManager.addGeneralResult(DART_ERRORS); 6009 _taskManager.addGeneralResult(DART_ERRORS);
6025 } 6010 }
6026 return _taskManager; 6011 return _taskManager;
6027 } 6012 }
6028 6013
6029 /** 6014 /**
6030 * Set plugins that are defined outside the `analyzer` package.
6031 */
6032 void set userDefinedPlugins(List<Plugin> plugins) {
6033 if (plugins == null) {
6034 plugins = <Plugin>[];
6035 }
6036 _userDefinedPlugins = plugins;
6037 _supportedPlugins = null;
6038 _taskManager = null;
6039 }
6040
6041 /**
6042 * Clear any caches holding on to analysis results so that a full re-analysis 6015 * Clear any caches holding on to analysis results so that a full re-analysis
6043 * will be performed the next time an analysis context is created. 6016 * will be performed the next time an analysis context is created.
6044 */ 6017 */
6045 void clearCaches() { 6018 void clearCaches() {
6046 partitionManager.clearCache(); 6019 partitionManager.clearCache();
6047 } 6020 }
6048 6021
6049 /** 6022 /**
6050 * Create and return a new context in which analysis can be performed. 6023 * Create and return a new context in which analysis can be performed.
6051 */ 6024 */
(...skipping 6084 matching lines...) Expand 10 before | Expand all | Expand 10 after
12136 PendingFuture pendingFuture = 12109 PendingFuture pendingFuture =
12137 new PendingFuture<T>(_context, source, computeValue); 12110 new PendingFuture<T>(_context, source, computeValue);
12138 if (!pendingFuture.evaluate(sourceEntry)) { 12111 if (!pendingFuture.evaluate(sourceEntry)) {
12139 _context._pendingFutureSources 12112 _context._pendingFutureSources
12140 .putIfAbsent(source, () => <PendingFuture>[]) 12113 .putIfAbsent(source, () => <PendingFuture>[])
12141 .add(pendingFuture); 12114 .add(pendingFuture);
12142 } 12115 }
12143 return pendingFuture.future; 12116 return pendingFuture.future;
12144 } 12117 }
12145 } 12118 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_abstract.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