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

Unified Diff: lib/src/mirror_loader.dart

Issue 880713002: add LibraryIdentifier (Closed) Base URL: git@github.com:dart-lang/static-init.git@master
Patch Set: code review updates Created 5 years, 11 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 | « lib/src/initializer.dart ('k') | lib/transformer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/mirror_loader.dart
diff --git a/lib/src/mirror_loader.dart b/lib/src/mirror_loader.dart
index 1512ec9b63f4f82506e3b26c581e70eb32214f18..f3e268904e6e45f903b1a7861760eaca5643e3ca 100644
--- a/lib/src/mirror_loader.dart
+++ b/lib/src/mirror_loader.dart
@@ -145,7 +145,22 @@ class InitializationCrawler {
annotatedValue = (declaration.owner as ObjectMirror)
.getField(declaration.simpleName).reflectee;
} else if (declaration is LibraryMirror) {
- annotatedValue = declaration.qualifiedName;
+ var package;
+ var filePath;
+ Uri uri = declaration.uri;
+ if (uri.scheme == 'file' || uri.scheme.startsWith('http')) {
+ filePath = path.url.relative(
+ uri.path, from: path.url.dirname(_root.uri.path));
+ } else if (uri.scheme == 'package') {
+ var segments = uri.pathSegments;
+ package = segments[0];
+ filePath = path.url.joinAll(segments.getRange(1, segments.length));
+ } else {
+ throw new UnsupportedError('Unsupported uri scheme ${uri.scheme} for '
+ 'library ${declaration}.');
+ }
+ annotatedValue =
+ new LibraryIdentifier(declaration.qualifiedName, package, filePath);
} else {
throw _UNSUPPORTED_DECLARATION;
}
« no previous file with comments | « lib/src/initializer.dart ('k') | lib/transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698