Chromium Code Reviews| 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; |
|
Roman
2012/07/30 14:43:30
you can check the uri scheme, I think, maybe that
Anton Muhin
2012/07/30 14:54:31
Do you want me to parse the string and then check
Roman
2012/07/30 15:03:42
Ah sorry, I thought it's a Uri object.
|
| + } |
| + } |
| + return false; |
| +} |