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

Unified Diff: pkg/smoke/test/codegen/testing_resolver_utils.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/smoke/pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « pkg/smoke/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698