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

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

Issue 1311843004: AnalysisEngine.userDefinedPlugins setter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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) 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 * source file is not scheduled to be analyzed within the context of the 549 * source file is not scheduled to be analyzed within the context of the
550 * given library. 550 * given library.
551 */ 551 */
552 CancelableFuture<CompilationUnit> computeResolvedCompilationUnitAsync( 552 CancelableFuture<CompilationUnit> computeResolvedCompilationUnitAsync(
553 Source source, Source librarySource); 553 Source source, Source librarySource);
554 554
555 /** 555 /**
556 * Perform work until the given [result] has been computed for the given 556 * Perform work until the given [result] has been computed for the given
557 * [target]. Return the computed value. 557 * [target]. Return the computed value.
558 */ 558 */
559 Object /*V*/ computeResult(AnalysisTarget target, ResultDescriptor /*<V>*/ res ult); 559 Object /*V*/ computeResult(
560 AnalysisTarget target, ResultDescriptor /*<V>*/ result);
560 561
561 /** 562 /**
562 * Notifies the context that the client is going to stop using this context. 563 * Notifies the context that the client is going to stop using this context.
563 */ 564 */
564 void dispose(); 565 void dispose();
565 566
566 /** 567 /**
567 * Return `true` if the given [source] exists. 568 * Return `true` if the given [source] exists.
568 * 569 *
569 * This method should be used rather than the method [Source.exists] because 570 * This method should be used rather than the method [Source.exists] because
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 */ 723 */
723 @deprecated 724 @deprecated
724 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource); 725 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource);
725 726
726 /** 727 /**
727 * Return the value of the given [result] for the given [target]. 728 * Return the value of the given [result] for the given [target].
728 * 729 *
729 * If the corresponding [target] does not exist, or the [result] is not 730 * If the corresponding [target] does not exist, or the [result] is not
730 * computed yet, then the default value is returned. 731 * computed yet, then the default value is returned.
731 */ 732 */
732 Object /*V*/ getResult(AnalysisTarget target, ResultDescriptor /*<V>*/ result) ; 733 Object /*V*/ getResult(
734 AnalysisTarget target, ResultDescriptor /*<V>*/ result);
733 735
734 /** 736 /**
735 * Return a list of the sources being analyzed in this context whose full path 737 * Return a list of the sources being analyzed in this context whose full path
736 * is equal to the given [path]. 738 * is equal to the given [path].
737 */ 739 */
738 List<Source> getSourcesWithFullName(String path); 740 List<Source> getSourcesWithFullName(String path);
739 741
740 /** 742 /**
741 * Invalidates hints in the given [librarySource] and included parts. 743 * Invalidates hints in the given [librarySource] and included parts.
742 */ 744 */
(...skipping 5153 matching lines...) Expand 10 before | Expand all | Expand 10 after
5896 */ 5898 */
5897 bool useTaskModel = false; 5899 bool useTaskModel = false;
5898 5900
5899 /** 5901 /**
5900 * A flag indicating whether the task model should attempt to limit 5902 * A flag indicating whether the task model should attempt to limit
5901 * invalidation after a change. 5903 * invalidation after a change.
5902 */ 5904 */
5903 bool limitInvalidationInTaskModel = false; 5905 bool limitInvalidationInTaskModel = false;
5904 5906
5905 /** 5907 /**
5908 * The plugins that are defined outside the `analyzer` package.
5909 */
5910 List<Plugin> _userDefinedPlugins = <Plugin>[];
5911
5912 /**
5906 * The task manager used to manage the tasks used to analyze code. 5913 * The task manager used to manage the tasks used to analyze code.
5907 */ 5914 */
5908 TaskManager _taskManager; 5915 TaskManager _taskManager;
5909 5916
5910 AnalysisEngine._(); 5917 AnalysisEngine._();
5911 5918
5912 /** 5919 /**
5913 * Return the instrumentation service that is to be used by this analysis 5920 * Return the instrumentation service that is to be used by this analysis
5914 * engine. 5921 * engine.
5915 */ 5922 */
(...skipping 28 matching lines...) Expand all
5944 /** 5951 /**
5945 * Return the list of supported plugins for processing by clients. 5952 * Return the list of supported plugins for processing by clients.
5946 */ 5953 */
5947 List<Plugin> get supportedPlugins { 5954 List<Plugin> get supportedPlugins {
5948 if (_supportedPlugins == null) { 5955 if (_supportedPlugins == null) {
5949 _supportedPlugins = <Plugin>[ 5956 _supportedPlugins = <Plugin>[
5950 enginePlugin, 5957 enginePlugin,
5951 commandLinePlugin, 5958 commandLinePlugin,
5952 optionsPlugin 5959 optionsPlugin
5953 ]; 5960 ];
5961 _supportedPlugins.addAll(_userDefinedPlugins);
5954 } 5962 }
5955 return _supportedPlugins; 5963 return _supportedPlugins;
5956 } 5964 }
5957 5965
5958 /** 5966 /**
5959 * Return the task manager used to manage the tasks used to analyze code. 5967 * Return the task manager used to manage the tasks used to analyze code.
5960 */ 5968 */
5961 TaskManager get taskManager { 5969 TaskManager get taskManager {
5962 if (_taskManager == null) { 5970 if (_taskManager == null) {
5963 if (enginePlugin.taskExtensionPoint == null) { 5971 new ExtensionManager().processPlugins(supportedPlugins);
5964 // The plugin wasn't used, so tasks are not registered.
5965 new ExtensionManager().processPlugins([enginePlugin]);
5966 }
5967 _taskManager = new TaskManager(); 5972 _taskManager = new TaskManager();
5968 _taskManager.addTaskDescriptors(enginePlugin.taskDescriptors); 5973 _taskManager.addTaskDescriptors(enginePlugin.taskDescriptors);
5969 // TODO(brianwilkerson) Create a way to associate different results with 5974 // TODO(brianwilkerson) Create a way to associate different results with
5970 // different file suffixes, then make this pluggable. 5975 // different file suffixes, then make this pluggable.
5971 _taskManager.addGeneralResult(DART_ERRORS); 5976 _taskManager.addGeneralResult(DART_ERRORS);
5972 } 5977 }
5973 return _taskManager; 5978 return _taskManager;
5974 } 5979 }
5975 5980
5976 /** 5981 /**
5982 * Set plugins that are defined outside the `analyzer` package.
5983 */
5984 void set userDefinedPlugins(List<Plugin> plugins) {
5985 if (plugins == null) {
5986 plugins = <Plugin>[];
5987 }
5988 _userDefinedPlugins = plugins;
5989 _supportedPlugins = null;
5990 _taskManager = null;
5991 }
5992
5993 /**
5977 * Clear any caches holding on to analysis results so that a full re-analysis 5994 * Clear any caches holding on to analysis results so that a full re-analysis
5978 * will be performed the next time an analysis context is created. 5995 * will be performed the next time an analysis context is created.
5979 */ 5996 */
5980 void clearCaches() { 5997 void clearCaches() {
5981 partitionManager.clearCache(); 5998 partitionManager.clearCache();
5982 } 5999 }
5983 6000
5984 /** 6001 /**
5985 * Create and return a new context in which analysis can be performed. 6002 * Create and return a new context in which analysis can be performed.
5986 */ 6003 */
(...skipping 6030 matching lines...) Expand 10 before | Expand all | Expand 10 after
12017 PendingFuture pendingFuture = 12034 PendingFuture pendingFuture =
12018 new PendingFuture<T>(_context, source, computeValue); 12035 new PendingFuture<T>(_context, source, computeValue);
12019 if (!pendingFuture.evaluate(sourceEntry)) { 12036 if (!pendingFuture.evaluate(sourceEntry)) {
12020 _context._pendingFutureSources 12037 _context._pendingFutureSources
12021 .putIfAbsent(source, () => <PendingFuture>[]) 12038 .putIfAbsent(source, () => <PendingFuture>[])
12022 .add(pendingFuture); 12039 .add(pendingFuture);
12023 } 12040 }
12024 return pendingFuture.future; 12041 return pendingFuture.future;
12025 } 12042 }
12026 } 12043 }
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