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

Unified Diff: pkg/analysis_testing/lib/mock_sdk.dart

Issue 428303004: Breaking changes in 'analyzer' package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename Source.resolveRelative to resolveRelativeUri, soften version constraints Created 6 years, 4 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 | « pkg/analysis_testing/lib/abstract_context.dart ('k') | pkg/analyzer/CHANGELOG.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_testing/lib/mock_sdk.dart
diff --git a/pkg/analysis_testing/lib/mock_sdk.dart b/pkg/analysis_testing/lib/mock_sdk.dart
index d4e7933f7edc598735a4730ebeec0c8c02aeec8c..52a30081390ae634dd282520c34c8a47771a690e 100644
--- a/pkg/analysis_testing/lib/mock_sdk.dart
+++ b/pkg/analysis_testing/lib/mock_sdk.dart
@@ -12,9 +12,6 @@ import 'package:analyzer/src/generated/source.dart';
class MockSdk implements DartSdk {
- final resource.MemoryResourceProvider provider =
- new resource.MemoryResourceProvider();
-
static const _MockSdkLibrary LIB_CORE =
const _MockSdkLibrary('dart:core', '/lib/core/core.dart', '''
library dart.core;
@@ -100,13 +97,15 @@ class HtmlElement {}
LIB_MATH,
LIB_HTML,];
+ final resource.MemoryResourceProvider provider =
+ new resource.MemoryResourceProvider();
+
MockSdk() {
LIBRARIES.forEach((_MockSdkLibrary library) {
provider.newFile(library.path, library.content);
});
}
- // Not used
@override
AnalysisContext get context => throw unimplemented;
@@ -121,17 +120,15 @@ class HtmlElement {}
@override
List<String> get uris => throw unimplemented;
- // Not used.
@override
- Source fromEncoding(UriKind kind, Uri uri) {
+ Source fromFileUri(Uri uri) {
resource.Resource file = provider.getResource(uri.path);
if (file is resource.File) {
- return file.createSource(kind);
+ return file.createSource(uri);
}
return null;
}
- // Not used.
@override
SdkLibrary getSdkLibrary(String dartUri) {
// getSdkLibrary() is only used to determine whether a library is internal
@@ -140,7 +137,6 @@ class HtmlElement {}
return null;
}
- // Not used.
@override
Source mapDartUri(String dartUri) {
const Map<String, String> uriToPath = const {
@@ -153,7 +149,8 @@ class HtmlElement {}
String path = uriToPath[dartUri];
if (path != null) {
resource.File file = provider.getResource(path);
- return file.createSource(UriKind.DART_URI);
+ Uri uri = new Uri(scheme: 'dart', path: dartUri.substring(5));
+ return file.createSource(uri);
}
// If we reach here then we tried to use a dartUri that's not in the
« no previous file with comments | « pkg/analysis_testing/lib/abstract_context.dart ('k') | pkg/analyzer/CHANGELOG.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698