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

Unified Diff: lib/compiler/implementation/dart_backend/emitter.dart

Issue 10829076: Support imports for dart: libs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
Index: lib/compiler/implementation/dart_backend/emitter.dart
diff --git a/lib/compiler/implementation/dart_backend/emitter.dart b/lib/compiler/implementation/dart_backend/emitter.dart
index 57da444ac46bd4c07bdc81875e41e7e2f37a8ed0..bf901207b6dfb36f653b07e66afa930ae38da4a9 100644
--- a/lib/compiler/implementation/dart_backend/emitter.dart
+++ b/lib/compiler/implementation/dart_backend/emitter.dart
@@ -9,7 +9,7 @@ class Emitter {
final Compiler compiler;
final StringBuffer sb;
- final Renamer renamer;
+ final ConflictingRenamer renamer;
Emitter(Compiler compiler) :
this.compiler = compiler,
@@ -72,5 +72,20 @@ class Emitter {
}
}
- String toString() => sb.toString();
+ String toString() {
+ final result = new StringBuffer();
+ final libraries = compiler.libraries;
+ for (final uri in libraries.getKeys()) {
+ // Same library element may be a value for different uris as of now
+ // e.g., core libraryElement is a value for both keys 'dart:core'
+ // and full file name. Only care about uris with dart scheme.
+ if (!uri.startsWith('dart:')) continue;
+ final lib = libraries[uri];
+ if (renamer.imports.containsKey(lib)) {
+ result.add('#import("$uri", prefix: "${renamer.imports[lib]}");');
+ }
+ }
+ result.add(sb);
+ return result.toString();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698