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

Unified Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1139463003: Fix for creating the correct SdkAnalysisContext. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/sdk_io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dc01ee1ea0c098b167d311f42521d1b450e68497..7054910d2b3eefa4d22966123d17ffc604fae0ff 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -885,6 +885,16 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
+ ChangeNoticeImpl getNotice(Source source) {
+ ChangeNoticeImpl notice = _pendingNotices[source];
+ if (notice == null) {
+ notice = new ChangeNoticeImpl(source);
+ _pendingNotices[source] = notice;
+ }
+ return notice;
+ }
+
+ @override
Namespace getPublicNamespace(LibraryElement library) {
// TODO(brianwilkerson) Rename this to not start with 'get'.
// Note that this is not part of the API of the interface.
@@ -1396,16 +1406,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
return notices;
}
- @override
- ChangeNoticeImpl getNotice(Source source) {
- ChangeNoticeImpl notice = _pendingNotices[source];
- if (notice == null) {
- notice = new ChangeNoticeImpl(source);
- _pendingNotices[source] = notice;
- }
- return notice;
- }
-
/**
* Return a list containing all of the sources known to this context that have
* the given [kind].
@@ -1970,6 +1970,26 @@ class PendingFuture<T> {
}
/**
+ * An [AnalysisContext] that only contains sources for a Dart SDK.
+ */
+class SdkAnalysisContext extends AnalysisContextImpl {
+ @override
+ AnalysisCache createCacheFromSourceFactory(SourceFactory factory) {
+ if (factory == null) {
+ return super.createCacheFromSourceFactory(factory);
+ }
+ DartSdk sdk = factory.dartSdk;
+ if (sdk == null) {
+ throw new IllegalArgumentException(
+ "The source factory for an SDK analysis context must have a DartUriResolver");
+ }
+ return new AnalysisCache(<CachePartition>[
+ AnalysisEngine.instance.partitionManager_new.forSdk(sdk)
+ ]);
+ }
+}
+
+/**
* A helper class used to create futures for AnalysisContextImpl. Using a helper
* class allows us to preserve the generic parameter T.
*/
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/sdk_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698