Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import "dart:math" as math; | 10 import "dart:math" as math; |
| 11 import 'dart:async'; | 11 import 'dart:async'; |
| 12 import 'dart:collection'; | 12 import 'dart:collection'; |
| 13 | 13 |
| 14 import 'package:analyzer/src/cancelable_future.dart'; | 14 import 'package:analyzer/src/cancelable_future.dart'; |
| 15 import 'package:analyzer/src/context/cache.dart' as cache; | |
| 16 import 'package:analyzer/src/context/context.dart' as cache; | |
|
kevmoo
2015/04/20 16:27:28
Two imports both 'as cache'
Brian Wilkerson
2015/04/20 16:29:52
You're right. That was a copy/paste error. I'll cl
| |
| 15 import 'package:analyzer/src/generated/incremental_resolution_validator.dart'; | 17 import 'package:analyzer/src/generated/incremental_resolution_validator.dart'; |
| 16 import 'package:analyzer/src/plugin/engine_plugin.dart'; | 18 import 'package:analyzer/src/plugin/engine_plugin.dart'; |
| 17 import 'package:analyzer/src/services/lint.dart'; | 19 import 'package:analyzer/src/services/lint.dart'; |
| 20 import 'package:analyzer/src/task/manager.dart'; | |
| 18 import 'package:analyzer/src/task/task_dart.dart'; | 21 import 'package:analyzer/src/task/task_dart.dart'; |
| 22 import 'package:analyzer/task/model.dart'; | |
| 19 | 23 |
| 20 import '../../instrumentation/instrumentation.dart'; | 24 import '../../instrumentation/instrumentation.dart'; |
| 21 import 'ast.dart'; | 25 import 'ast.dart'; |
| 22 import 'constant.dart'; | 26 import 'constant.dart'; |
| 23 import 'element.dart'; | 27 import 'element.dart'; |
| 24 import 'error.dart'; | 28 import 'error.dart'; |
| 25 import 'error_verifier.dart'; | 29 import 'error_verifier.dart'; |
| 26 import 'html.dart' as ht; | 30 import 'html.dart' as ht; |
| 27 import 'incremental_resolver.dart' | 31 import 'incremental_resolver.dart' |
| 28 show IncrementalResolver, PoorMansIncrementalResolver; | 32 show IncrementalResolver, PoorMansIncrementalResolver; |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1125 | 1129 |
| 1126 @override | 1130 @override |
| 1127 set contentCache(ContentCache value) { | 1131 set contentCache(ContentCache value) { |
| 1128 _contentCache = value; | 1132 _contentCache = value; |
| 1129 } | 1133 } |
| 1130 | 1134 |
| 1131 @override | 1135 @override |
| 1132 DeclaredVariables get declaredVariables => _declaredVariables; | 1136 DeclaredVariables get declaredVariables => _declaredVariables; |
| 1133 | 1137 |
| 1134 @override | 1138 @override |
| 1139 List<AnalysisTarget> get explicitTargets { | |
| 1140 List<AnalysisTarget> targets = <AnalysisTarget>[]; | |
| 1141 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | |
| 1142 while (iterator.moveNext()) { | |
| 1143 if (iterator.value.explicitlyAdded) { | |
| 1144 targets.add(iterator.key); | |
| 1145 } | |
| 1146 } | |
| 1147 return targets; | |
| 1148 } | |
| 1149 | |
| 1150 @override | |
| 1135 List<Source> get htmlSources => _getSources(SourceKind.HTML); | 1151 List<Source> get htmlSources => _getSources(SourceKind.HTML); |
| 1136 | 1152 |
| 1137 @override | 1153 @override |
| 1138 bool get isDisposed => _disposed; | 1154 bool get isDisposed => _disposed; |
| 1139 | 1155 |
| 1140 @override | 1156 @override |
| 1141 List<Source> get launchableClientLibrarySources { | 1157 List<Source> get launchableClientLibrarySources { |
| 1142 // TODO(brianwilkerson) This needs to filter out libraries that do not | 1158 // TODO(brianwilkerson) This needs to filter out libraries that do not |
| 1143 // reference dart:html, either directly or indirectly. | 1159 // reference dart:html, either directly or indirectly. |
| 1144 List<Source> sources = new List<Source>(); | 1160 List<Source> sources = new List<Source>(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1322 /** | 1338 /** |
| 1323 * Make _pendingFutureSources available to unit tests. | 1339 * Make _pendingFutureSources available to unit tests. |
| 1324 */ | 1340 */ |
| 1325 HashMap<Source, List<PendingFuture>> get pendingFutureSources_forTesting => | 1341 HashMap<Source, List<PendingFuture>> get pendingFutureSources_forTesting => |
| 1326 _pendingFutureSources; | 1342 _pendingFutureSources; |
| 1327 | 1343 |
| 1328 @override | 1344 @override |
| 1329 List<Source> get prioritySources => _priorityOrder; | 1345 List<Source> get prioritySources => _priorityOrder; |
| 1330 | 1346 |
| 1331 @override | 1347 @override |
| 1348 List<AnalysisTarget> get priorityTargets => prioritySources; | |
| 1349 | |
| 1350 @override | |
| 1332 List<Source> get refactoringUnsafeSources { | 1351 List<Source> get refactoringUnsafeSources { |
| 1333 List<Source> sources = new List<Source>(); | 1352 List<Source> sources = new List<Source>(); |
| 1334 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | 1353 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); |
| 1335 while (iterator.moveNext()) { | 1354 while (iterator.moveNext()) { |
| 1336 SourceEntry sourceEntry = iterator.value; | 1355 SourceEntry sourceEntry = iterator.value; |
| 1337 if (sourceEntry is DartEntry) { | 1356 if (sourceEntry is DartEntry) { |
| 1338 Source source = iterator.key; | 1357 Source source = iterator.key; |
| 1339 if (!source.isInSystemLibrary && !sourceEntry.isRefactoringSafe) { | 1358 if (!source.isInSystemLibrary && !sourceEntry.isRefactoringSafe) { |
| 1340 sources.add(source); | 1359 sources.add(source); |
| 1341 } | 1360 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1819 } | 1838 } |
| 1820 } | 1839 } |
| 1821 } | 1840 } |
| 1822 } on _ElementByIdFinderException { | 1841 } on _ElementByIdFinderException { |
| 1823 return finder.result; | 1842 return finder.result; |
| 1824 } | 1843 } |
| 1825 return null; | 1844 return null; |
| 1826 } | 1845 } |
| 1827 | 1846 |
| 1828 @override | 1847 @override |
| 1848 cache.CacheEntry getCacheEntry(AnalysisTarget target) { | |
| 1849 return null; | |
| 1850 } | |
| 1851 | |
| 1852 @override | |
| 1829 CompilationUnitElement getCompilationUnitElement( | 1853 CompilationUnitElement getCompilationUnitElement( |
| 1830 Source unitSource, Source librarySource) { | 1854 Source unitSource, Source librarySource) { |
| 1831 LibraryElement libraryElement = getLibraryElement(librarySource); | 1855 LibraryElement libraryElement = getLibraryElement(librarySource); |
| 1832 if (libraryElement != null) { | 1856 if (libraryElement != null) { |
| 1833 // try defining unit | 1857 // try defining unit |
| 1834 CompilationUnitElement definingUnit = | 1858 CompilationUnitElement definingUnit = |
| 1835 libraryElement.definingCompilationUnit; | 1859 libraryElement.definingCompilationUnit; |
| 1836 if (definingUnit.source == unitSource) { | 1860 if (definingUnit.source == unitSource) { |
| 1837 return definingUnit; | 1861 return definingUnit; |
| 1838 } | 1862 } |
| (...skipping 3893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5732 * The instrumentation service that is to be used by this analysis engine. | 5756 * The instrumentation service that is to be used by this analysis engine. |
| 5733 */ | 5757 */ |
| 5734 InstrumentationService _instrumentationService = | 5758 InstrumentationService _instrumentationService = |
| 5735 InstrumentationService.NULL_SERVICE; | 5759 InstrumentationService.NULL_SERVICE; |
| 5736 | 5760 |
| 5737 /** | 5761 /** |
| 5738 * The partition manager being used to manage the shared partitions. | 5762 * The partition manager being used to manage the shared partitions. |
| 5739 */ | 5763 */ |
| 5740 final PartitionManager partitionManager = new PartitionManager(); | 5764 final PartitionManager partitionManager = new PartitionManager(); |
| 5741 | 5765 |
| 5766 /** | |
| 5767 * The partition manager being used to manage the shared partitions. | |
| 5768 */ | |
| 5769 final cache.PartitionManager partitionManager_new = | |
| 5770 new cache.PartitionManager(); | |
| 5771 | |
| 5772 /** | |
| 5773 * A flag indicating whether the (new) task model should be used to perform | |
| 5774 * analysis. | |
| 5775 */ | |
| 5776 bool useTaskModel = false; | |
| 5777 | |
| 5778 /** | |
| 5779 * The task manager used to manage the tasks used to analyze code. | |
| 5780 */ | |
| 5781 TaskManager _taskManager; | |
| 5782 | |
| 5783 /** | |
| 5784 * A flag indicating whether union types should be used. | |
| 5785 */ | |
| 5786 bool enableUnionTypes = false; | |
|
scheglov
2015/04/20 03:44:50
IIRC Paul removed union types support some a week
Brian Wilkerson
2015/04/20 15:00:36
Yes. That resulted from a merge issue. I've re-rem
| |
| 5787 | |
| 5788 /** | |
| 5789 * A flag indicating whether union types should have strict semantics. This | |
| 5790 * option has no effect when `enabledUnionTypes` is `false`. | |
| 5791 */ | |
| 5792 bool strictUnionTypes = false; | |
| 5793 | |
| 5742 AnalysisEngine._(); | 5794 AnalysisEngine._(); |
| 5743 | 5795 |
| 5744 /** | 5796 /** |
| 5745 * Return the instrumentation service that is to be used by this analysis | 5797 * Return the instrumentation service that is to be used by this analysis |
| 5746 * engine. | 5798 * engine. |
| 5747 */ | 5799 */ |
| 5748 InstrumentationService get instrumentationService => _instrumentationService; | 5800 InstrumentationService get instrumentationService => _instrumentationService; |
| 5749 | 5801 |
| 5750 /** | 5802 /** |
| 5751 * Set the instrumentation service that is to be used by this analysis engine | 5803 * Set the instrumentation service that is to be used by this analysis engine |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 5767 | 5819 |
| 5768 /** | 5820 /** |
| 5769 * Set the logger that should receive information about errors within the | 5821 * Set the logger that should receive information about errors within the |
| 5770 * analysis engine to the given [logger]. | 5822 * analysis engine to the given [logger]. |
| 5771 */ | 5823 */ |
| 5772 void set logger(Logger logger) { | 5824 void set logger(Logger logger) { |
| 5773 this._logger = logger == null ? Logger.NULL : logger; | 5825 this._logger = logger == null ? Logger.NULL : logger; |
| 5774 } | 5826 } |
| 5775 | 5827 |
| 5776 /** | 5828 /** |
| 5829 * Return the task manager used to manage the tasks used to analyze code. | |
| 5830 */ | |
| 5831 TaskManager get taskManager { | |
| 5832 if (_taskManager == null) { | |
| 5833 _taskManager = new TaskManager(); | |
| 5834 _taskManager.addTaskDescriptors(enginePlugin.taskDescriptors()); | |
| 5835 } | |
| 5836 return _taskManager; | |
| 5837 } | |
| 5838 | |
| 5839 /** | |
| 5777 * Clear any caches holding on to analysis results so that a full re-analysis | 5840 * Clear any caches holding on to analysis results so that a full re-analysis |
| 5778 * will be performed the next time an analysis context is created. | 5841 * will be performed the next time an analysis context is created. |
| 5779 */ | 5842 */ |
| 5780 void clearCaches() { | 5843 void clearCaches() { |
| 5781 partitionManager.clearCache(); | 5844 partitionManager.clearCache(); |
| 5782 } | 5845 } |
| 5783 | 5846 |
| 5784 /** | 5847 /** |
| 5785 * Create and return a new context in which analysis can be performed. | 5848 * Create and return a new context in which analysis can be performed. |
| 5786 */ | 5849 */ |
| (...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7165 CycleBuilder_LibraryPair(ResolvableLibrary library, | 7228 CycleBuilder_LibraryPair(ResolvableLibrary library, |
| 7166 List<CycleBuilder_SourceEntryPair> entryPairs) { | 7229 List<CycleBuilder_SourceEntryPair> entryPairs) { |
| 7167 this.library = library; | 7230 this.library = library; |
| 7168 this.entryPairs = entryPairs; | 7231 this.entryPairs = entryPairs; |
| 7169 } | 7232 } |
| 7170 } | 7233 } |
| 7171 | 7234 |
| 7172 /** | 7235 /** |
| 7173 * A pair containing a source and the cache entry associated with that source. | 7236 * A pair containing a source and the cache entry associated with that source. |
| 7174 * They are used to reduce the number of times an entry must be looked up in the | 7237 * They are used to reduce the number of times an entry must be looked up in the |
| 7175 * [cache]. | 7238 * cache. |
| 7176 */ | 7239 */ |
| 7177 class CycleBuilder_SourceEntryPair { | 7240 class CycleBuilder_SourceEntryPair { |
| 7178 /** | 7241 /** |
| 7179 * The source associated with the entry. | 7242 * The source associated with the entry. |
| 7180 */ | 7243 */ |
| 7181 Source source; | 7244 Source source; |
| 7182 | 7245 |
| 7183 /** | 7246 /** |
| 7184 * The entry associated with the source. | 7247 * The entry associated with the source. |
| 7185 */ | 7248 */ |
| (...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9003 */ | 9066 */ |
| 9004 abstract class InternalAnalysisContext implements AnalysisContext { | 9067 abstract class InternalAnalysisContext implements AnalysisContext { |
| 9005 /** | 9068 /** |
| 9006 * Allow the client to supply its own content cache. This will take the | 9069 * Allow the client to supply its own content cache. This will take the |
| 9007 * place of the content cache created by default, allowing clients to share | 9070 * place of the content cache created by default, allowing clients to share |
| 9008 * the content cache between contexts. | 9071 * the content cache between contexts. |
| 9009 */ | 9072 */ |
| 9010 set contentCache(ContentCache value); | 9073 set contentCache(ContentCache value); |
| 9011 | 9074 |
| 9012 /** | 9075 /** |
| 9076 * Return a list of the explicit targets being analyzed by this context. | |
| 9077 */ | |
| 9078 List<AnalysisTarget> get explicitTargets; | |
| 9079 | |
| 9080 /** | |
| 9081 * A factory to override how [LibraryResolver] is created. | |
| 9082 */ | |
| 9083 LibraryResolverFactory get libraryResolverFactory; | |
| 9084 | |
| 9085 /** | |
| 9013 * Return a list containing all of the sources that have been marked as | 9086 * Return a list containing all of the sources that have been marked as |
| 9014 * priority sources. Clients must not modify the returned list. | 9087 * priority sources. Clients must not modify the returned list. |
| 9015 */ | 9088 */ |
| 9016 List<Source> get prioritySources; | 9089 List<Source> get prioritySources; |
| 9017 | 9090 |
| 9018 /** | 9091 /** |
| 9092 * Return a list of the priority targets being analyzed by this context. | |
| 9093 */ | |
| 9094 List<AnalysisTarget> get priorityTargets; | |
| 9095 | |
| 9096 /** | |
| 9019 * A factory to override how [ResolverVisitor] is created. | 9097 * A factory to override how [ResolverVisitor] is created. |
| 9020 */ | 9098 */ |
| 9021 ResolverVisitorFactory get resolverVisitorFactory; | 9099 ResolverVisitorFactory get resolverVisitorFactory; |
| 9022 | 9100 |
| 9023 /** | 9101 /** |
| 9024 * Returns a statistics about this context. | 9102 * Returns a statistics about this context. |
| 9025 */ | 9103 */ |
| 9026 AnalysisContextStatistics get statistics; | 9104 AnalysisContextStatistics get statistics; |
| 9027 | 9105 |
| 9028 /** | 9106 /** |
| 9029 * Sets the [TypeProvider] for this context. | 9107 * Sets the [TypeProvider] for this context. |
| 9030 */ | 9108 */ |
| 9031 void set typeProvider(TypeProvider typeProvider); | 9109 void set typeProvider(TypeProvider typeProvider); |
| 9032 | 9110 |
| 9033 /** | 9111 /** |
| 9034 * A factory to override how [TypeResolverVisitor] is created. | 9112 * A factory to override how [TypeResolverVisitor] is created. |
| 9035 */ | 9113 */ |
| 9036 TypeResolverVisitorFactory get typeResolverVisitorFactory; | 9114 TypeResolverVisitorFactory get typeResolverVisitorFactory; |
| 9037 | 9115 |
| 9038 /** | 9116 /** |
| 9039 * A factory to override how [LibraryResolver] is created. | |
| 9040 */ | |
| 9041 LibraryResolverFactory get libraryResolverFactory; | |
| 9042 | |
| 9043 /** | |
| 9044 * Add the given [source] with the given [information] to this context. | 9117 * Add the given [source] with the given [information] to this context. |
| 9045 */ | 9118 */ |
| 9046 void addSourceInfo(Source source, SourceEntry information); | 9119 void addSourceInfo(Source source, SourceEntry information); |
| 9047 | 9120 |
| 9048 /** | 9121 /** |
| 9049 * Return a list containing the sources of the libraries that are exported by | 9122 * Return a list containing the sources of the libraries that are exported by |
| 9050 * the library with the given [source]. The list will be empty if the given | 9123 * the library with the given [source]. The list will be empty if the given |
| 9051 * source is invalid, if the given source does not represent a library, or if | 9124 * source is invalid, if the given source does not represent a library, or if |
| 9052 * the library does not export any other libraries. | 9125 * the library does not export any other libraries. |
| 9053 * | 9126 * |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 9079 CompilationUnit computeResolvableCompilationUnit(Source source); | 9152 CompilationUnit computeResolvableCompilationUnit(Source source); |
| 9080 | 9153 |
| 9081 /** | 9154 /** |
| 9082 * Return all the resolved [CompilationUnit]s for the given [source] if not | 9155 * Return all the resolved [CompilationUnit]s for the given [source] if not |
| 9083 * flushed, otherwise return `null` and ensures that the [CompilationUnit]s | 9156 * flushed, otherwise return `null` and ensures that the [CompilationUnit]s |
| 9084 * will be eventually returned to the client from [performAnalysisTask]. | 9157 * will be eventually returned to the client from [performAnalysisTask]. |
| 9085 */ | 9158 */ |
| 9086 List<CompilationUnit> ensureResolvedDartUnits(Source source); | 9159 List<CompilationUnit> ensureResolvedDartUnits(Source source); |
| 9087 | 9160 |
| 9088 /** | 9161 /** |
| 9162 * Return the cache entry associated with the given [target]. | |
| 9163 */ | |
| 9164 cache.CacheEntry getCacheEntry(AnalysisTarget target); | |
| 9165 | |
| 9166 /** | |
| 9089 * Return context that owns the given [source]. | 9167 * Return context that owns the given [source]. |
| 9090 */ | 9168 */ |
| 9091 InternalAnalysisContext getContextFor(Source source); | 9169 InternalAnalysisContext getContextFor(Source source); |
| 9092 | 9170 |
| 9093 /** | 9171 /** |
| 9094 * Return a namespace containing mappings for all of the public names defined | 9172 * Return a namespace containing mappings for all of the public names defined |
| 9095 * by the given [library]. | 9173 * by the given [library]. |
| 9096 */ | 9174 */ |
| 9097 Namespace getPublicNamespace(LibraryElement library); | 9175 Namespace getPublicNamespace(LibraryElement library); |
| 9098 | 9176 |
| (...skipping 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11669 visitElement(Element element) { | 11747 visitElement(Element element) { |
| 11670 if (element.id == _id) { | 11748 if (element.id == _id) { |
| 11671 result = element; | 11749 result = element; |
| 11672 throw new _ElementByIdFinderException(); | 11750 throw new _ElementByIdFinderException(); |
| 11673 } | 11751 } |
| 11674 super.visitElement(element); | 11752 super.visitElement(element); |
| 11675 } | 11753 } |
| 11676 } | 11754 } |
| 11677 | 11755 |
| 11678 class _ElementByIdFinderException {} | 11756 class _ElementByIdFinderException {} |
| OLD | NEW |