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 |
207 @override | 216 @override |
208 ResultProvider resultProvider; | 217 ResultProvider resultProvider; |
209 | 218 |
210 /** | 219 /** |
211 * The map of [ResultChangedEvent] controllers. | 220 * The map of [ResultChangedEvent] controllers. |
212 */ | 221 */ |
213 final Map<ResultDescriptor, StreamController<ResultChangedEvent>> | 222 final Map<ResultDescriptor, StreamController<ResultChangedEvent>> |
214 _resultChangedControllers = | 223 _resultChangedControllers = |
215 <ResultDescriptor, StreamController<ResultChangedEvent>>{}; | 224 <ResultDescriptor, StreamController<ResultChangedEvent>>{}; |
216 | 225 |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 } | 741 } |
733 | 742 |
734 /** | 743 /** |
735 * Create an analysis cache based on the given source [factory]. | 744 * Create an analysis cache based on the given source [factory]. |
736 */ | 745 */ |
737 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { | 746 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { |
738 AnalysisCache createCache() { | 747 AnalysisCache createCache() { |
739 if (factory == null) { | 748 if (factory == null) { |
740 return new AnalysisCache(<CachePartition>[_privatePartition]); | 749 return new AnalysisCache(<CachePartition>[_privatePartition]); |
741 } | 750 } |
| 751 if (!useSdkCachePartition) { |
| 752 return new AnalysisCache(<CachePartition>[_privatePartition]); |
| 753 } |
742 DartSdk sdk = factory.dartSdk; | 754 DartSdk sdk = factory.dartSdk; |
743 if (sdk == null) { | 755 if (sdk == null) { |
744 return new AnalysisCache(<CachePartition>[_privatePartition]); | 756 return new AnalysisCache(<CachePartition>[_privatePartition]); |
745 } | 757 } |
746 return new AnalysisCache(<CachePartition>[ | 758 return new AnalysisCache(<CachePartition>[ |
747 AnalysisEngine.instance.partitionManager.forSdk(sdk), | 759 AnalysisEngine.instance.partitionManager.forSdk(sdk), |
748 _privatePartition | 760 _privatePartition |
749 ]); | 761 ]); |
750 } | 762 } |
751 | 763 |
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2264 } | 2276 } |
2265 DartSdk sdk = factory.dartSdk; | 2277 DartSdk sdk = factory.dartSdk; |
2266 if (sdk == null) { | 2278 if (sdk == null) { |
2267 throw new ArgumentError( | 2279 throw new ArgumentError( |
2268 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2280 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
2269 } | 2281 } |
2270 return new AnalysisCache( | 2282 return new AnalysisCache( |
2271 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2283 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
2272 } | 2284 } |
2273 } | 2285 } |
OLD | NEW |