Index: pkg/analyzer/lib/src/context/context.dart |
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart |
index 52a64b7fc47df3d2b1a8b85632b4658ff2c80400..5c20e0bf5d3c36f14502cf2fda5d90e79c48979d 100644 |
--- a/pkg/analyzer/lib/src/context/context.dart |
+++ b/pkg/analyzer/lib/src/context/context.dart |
@@ -204,6 +204,15 @@ class AnalysisContextImpl implements InternalAnalysisContext { |
*/ |
List<AnalysisListener> _listeners = new List<AnalysisListener>(); |
+ /** |
+ * Determines whether this context should attempt to make use of the global |
+ * SDK cache partition. Note that if this context is responsible for |
+ * resynthesizing the SDK element model, this flag should be set to `false`, |
+ * so that resynthesized elements belonging to this context won't leak into |
+ * the global SDK cache partition. |
+ */ |
+ bool useSdkCachePartition = true; |
+ |
@override |
ResultProvider resultProvider; |
@@ -739,6 +748,9 @@ class AnalysisContextImpl implements InternalAnalysisContext { |
if (factory == null) { |
return new AnalysisCache(<CachePartition>[_privatePartition]); |
} |
+ if (!useSdkCachePartition) { |
+ return new AnalysisCache(<CachePartition>[_privatePartition]); |
+ } |
DartSdk sdk = factory.dartSdk; |
if (sdk == null) { |
return new AnalysisCache(<CachePartition>[_privatePartition]); |