Index: pkg/smoke/test/codegen/testing_resolver_utils.dart |
diff --git a/pkg/smoke/test/codegen/testing_resolver_utils.dart b/pkg/smoke/test/codegen/testing_resolver_utils.dart |
index 7a76614f5dc030967df81548152f76d7e5f1434f..1a0e6e85c22434ae335f9b48487ef9b6eb1bdb61 100644 |
--- a/pkg/smoke/test/codegen/testing_resolver_utils.dart |
+++ b/pkg/smoke/test/codegen/testing_resolver_utils.dart |
@@ -34,7 +34,7 @@ LibraryProvider initAnalyzer(Map<String, String> contents) { |
sdk.context.analysisOptions = options; |
var changes = new ChangeSet(); |
var allSources = {}; |
- contents.forEach((url, code) { |
+ contents.forEach((url, code) { |
var source = new _SimpleSource(url, code, allSources); |
allSources[url] = source; |
changes.addedSource(source); |
@@ -62,11 +62,13 @@ class _SimpleUriResolver implements UriResolver { |
} |
class _SimpleSource extends Source { |
+ final Uri uri; |
final String path; |
final String rawContents; |
final Map<String, Source> allSources; |
- _SimpleSource(this.path, this.rawContents, this.allSources); |
+ _SimpleSource(this.path, this.rawContents, this.allSources) |
+ : uri = Uri.parse('file:///path'); |
operator ==(other) => other is _SimpleSource && |
rawContents == other.rawContents; |
@@ -91,6 +93,16 @@ class _SimpleSource extends Source { |
throw new UnimplementedError('relative URIs not supported: $uri'); |
} |
+ // Since this is just for simple tests we just restricted this mock |
+ // to root-relative imports. For more sophisticated stuff, you should be |
+ // using the test helpers in `package:code_transformers`. |
+ Uri resolveRelativeUri(Uri uri) { |
+ if (!uri.path.startsWith('/')) { |
+ throw new UnimplementedError('relative URIs not supported: $uri'); |
+ } |
+ return uri; |
+ } |
+ |
void getContentsToReceiver(Source_ContentReceiver receiver) { |
receiver.accept(rawContents, modificationStamp); |
} |