| OLD | NEW |
| 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.context.context; | 5 library analyzer.src.context.context; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 * not) being implicitly analyzed. | 197 * not) being implicitly analyzed. |
| 198 */ | 198 */ |
| 199 StreamController<ImplicitAnalysisEvent> _implicitAnalysisEventsController; | 199 StreamController<ImplicitAnalysisEvent> _implicitAnalysisEventsController; |
| 200 | 200 |
| 201 /** | 201 /** |
| 202 * The listeners that are to be notified when various analysis results are | 202 * The listeners that are to be notified when various analysis results are |
| 203 * produced in this context. | 203 * produced in this context. |
| 204 */ | 204 */ |
| 205 List<AnalysisListener> _listeners = new List<AnalysisListener>(); | 205 List<AnalysisListener> _listeners = new List<AnalysisListener>(); |
| 206 | 206 |
| 207 /** | |
| 208 * Determines whether this context should attempt to make use of the global | |
| 209 * SDK cache partition. Note that if this context is responsible for | |
| 210 * resynthesizing the SDK element model, this flag should be set to `false`, | |
| 211 * so that resynthesized elements belonging to this context won't leak into | |
| 212 * the global SDK cache partition. | |
| 213 */ | |
| 214 bool useSdkCachePartition = true; | |
| 215 | |
| 216 @override | 207 @override |
| 217 ResultProvider resultProvider; | 208 ResultProvider resultProvider; |
| 218 | 209 |
| 219 /** | 210 /** |
| 220 * The map of [ResultChangedEvent] controllers. | 211 * The map of [ResultChangedEvent] controllers. |
| 221 */ | 212 */ |
| 222 final Map<ResultDescriptor, StreamController<ResultChangedEvent>> | 213 final Map<ResultDescriptor, StreamController<ResultChangedEvent>> |
| 223 _resultChangedControllers = | 214 _resultChangedControllers = |
| 224 <ResultDescriptor, StreamController<ResultChangedEvent>>{}; | 215 <ResultDescriptor, StreamController<ResultChangedEvent>>{}; |
| 225 | 216 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 } | 732 } |
| 742 | 733 |
| 743 /** | 734 /** |
| 744 * Create an analysis cache based on the given source [factory]. | 735 * Create an analysis cache based on the given source [factory]. |
| 745 */ | 736 */ |
| 746 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { | 737 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { |
| 747 AnalysisCache createCache() { | 738 AnalysisCache createCache() { |
| 748 if (factory == null) { | 739 if (factory == null) { |
| 749 return new AnalysisCache(<CachePartition>[_privatePartition]); | 740 return new AnalysisCache(<CachePartition>[_privatePartition]); |
| 750 } | 741 } |
| 751 if (!useSdkCachePartition) { | |
| 752 return new AnalysisCache(<CachePartition>[_privatePartition]); | |
| 753 } | |
| 754 DartSdk sdk = factory.dartSdk; | 742 DartSdk sdk = factory.dartSdk; |
| 755 if (sdk == null) { | 743 if (sdk == null) { |
| 756 return new AnalysisCache(<CachePartition>[_privatePartition]); | 744 return new AnalysisCache(<CachePartition>[_privatePartition]); |
| 757 } | 745 } |
| 758 return new AnalysisCache(<CachePartition>[ | 746 return new AnalysisCache(<CachePartition>[ |
| 759 AnalysisEngine.instance.partitionManager.forSdk(sdk), | 747 AnalysisEngine.instance.partitionManager.forSdk(sdk), |
| 760 _privatePartition | 748 _privatePartition |
| 761 ]); | 749 ]); |
| 762 } | 750 } |
| 763 | 751 |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 } | 2264 } |
| 2277 DartSdk sdk = factory.dartSdk; | 2265 DartSdk sdk = factory.dartSdk; |
| 2278 if (sdk == null) { | 2266 if (sdk == null) { |
| 2279 throw new ArgumentError( | 2267 throw new ArgumentError( |
| 2280 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2268 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
| 2281 } | 2269 } |
| 2282 return new AnalysisCache( | 2270 return new AnalysisCache( |
| 2283 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2271 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
| 2284 } | 2272 } |
| 2285 } | 2273 } |
| OLD | NEW |