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

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

Issue 10829076: Support imports for dart: libs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Better version 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/backend.dart
diff --git a/lib/compiler/implementation/dart_backend/backend.dart b/lib/compiler/implementation/dart_backend/backend.dart
index b3795b1172c19f33ab328577384b12ef686896e3..ac03dfe86c7658f555d6a303d7397fb7859583d2 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -64,12 +64,10 @@ class DartBackend extends Backend {
compiler.jsHelperLibrary,
compiler.interceptorsLibrary,
];
- compiler.libraries.forEach((uri, lib) {
- if (uri.startsWith('dart:')) LIBS_TO_IGNORE.add(lib);
- });
bool shouldOutput(Element element) =>
element.kind !== ElementKind.VOID &&
- LIBS_TO_IGNORE.indexOf(element.getLibrary()) == -1;
+ LIBS_TO_IGNORE.indexOf(element.getLibrary()) == -1 &&
+ !isDartCoreLib(compiler, element.getLibrary());
try {
Emitter emitter = new Emitter(compiler);
@@ -103,3 +101,17 @@ main() {
log(String message) => compiler.log('[DartBackend] $message');
}
+
+/**
+ * Checks if [:libraryElement:] is a core lib, that is a library
+ * provided by the implementation like dart:core, dart:coreimpl, etc.
+ */
+bool isDartCoreLib(Compiler compiler, LibraryElement libraryElement) {
+ final libraries = compiler.libraries;
+ for (final uri in libraries.getKeys()) {
+ if (libraryElement === libraries[uri]) {
+ if (uri.startsWith('dart:')) return true;
+ }
+ }
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698