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

Unified Diff: lib/transformer.dart

Issue 973073003: fix a few issues around exported libraries (Closed) Base URL: git@github.com:dart-lang/static-init.git@master
Patch Set: use .path instead of .toString Created 5 years, 10 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/mirror_loader.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/transformer.dart
diff --git a/lib/transformer.dart b/lib/transformer.dart
index 90faf5d25f8e10406620482fc3604042d15dbfac..903abfa592b9547406c54c0fa75bba0380d1b6e9 100644
--- a/lib/transformer.dart
+++ b/lib/transformer.dart
@@ -239,11 +239,11 @@ class _BootstrapFileBuilder {
seen.add(library);
// Visit all our dependencies.
- for (var importedLibrary in _sortedLibraryImports(library)) {
+ for (var library in _sortedLibraryDependencies(library)) {
// Don't include anything from the sdk.
- if (importedLibrary.isInSdk) continue;
- if (seen.contains(importedLibrary)) continue;
- _readLibraries(importedLibrary, seen);
+ if (library.isInSdk) continue;
+ if (seen.contains(library)) continue;
+ _readLibraries(library, seen);
}
// Read annotations in this order: library, top level methods, classes.
@@ -415,14 +415,21 @@ $initializersBuffer
}
}
- Iterable<LibraryElement> _sortedLibraryImports(LibraryElement library) =>
- (new List.from(library.imports)
- ..sort((ImportElement a, ImportElement b) {
+ Iterable<LibraryElement> _sortedLibraryDependencies(LibraryElement library) {
+ // TODO(jakemac): Investigate supporting annotations on part-of directives.
+ getLibrary(UriReferencedElement element) {
+ if (element is ImportElement) return element.importedLibrary;
+ if (element is ExportElement) return element.exportedLibrary;
+ }
+
+ return (new List.from(library.imports)
+ ..addAll(library.exports)
+ ..sort((a, b) {
// dart: imports don't have a uri
if (a.uri == null && b.uri != null) return -1;
if (b.uri == null && a.uri != null) return 1;
if (a.uri == null && b.uri == null) {
- return a.importedLibrary.name.compareTo(b.importedLibrary.name);
+ return getLibrary(a).name.compareTo(getLibrary(b).name);
}
// package: imports next
@@ -442,7 +449,8 @@ $initializersBuffer
var bUri = path.url.relative(b.source.uri.path,
from: path.url.dirname(library.source.uri.path));
return aUri.compareTo(bUri);
- })).map((import) => import.importedLibrary);
+ })).map(getLibrary);
+ }
}
/// An [Initializer] annotation and the target of that annotation.
« no previous file with comments | « lib/src/mirror_loader.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698