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 b03c108c4204ee3cf76c583321093b9c8c1ec910..86cc25a536f3e799900eef27c929b363752d6220 100644 |
| --- a/lib/compiler/implementation/dart_backend/backend.dart |
| +++ b/lib/compiler/implementation/dart_backend/backend.dart |
| @@ -42,9 +42,28 @@ class DartBackend extends Backend { |
| throw new BailoutException(reason); |
| } |
| + /** |
| + * Tells whether we should output given element. Corelib classes like |
| + * Object should not be in the resulting code. |
| + */ |
| + bool shouldOutput(Element element) { |
| + var compilationUnitUri = element.getCompilationUnit().script.uri; |
| + if (compilationUnitUri !== null && compilationUnitUri.path !== null && |
|
Anton Muhin
2012/07/09 18:31:26
I believe (but not 100% sure) that we have a refer
Roman
2012/07/10 03:20:29
Done.
Thanks! Indeed we have reference in compiler
|
| + // TODO(smok): URI hacks, should we have a special 'core' flag for |
| + // elements from corelib? |
| + (compilationUnitUri.path.endsWith('/core.dart') |
| + || compilationUnitUri.path.contains('/corelib/src/'))) { |
| + return false; |
| + } |
| + return element.kind !== ElementKind.VOID; |
| + } |
| + |
| try { |
| StringBuffer sb = new StringBuffer(); |
| resolvedElements.forEach((element, treeElements) { |
| + if (!shouldOutput(element)) { |
|
Anton Muhin
2012/07/09 18:31:26
nit: single line.
Roman
2012/07/10 03:20:29
Done.
|
| + return; |
| + } |
| if (!element.isTopLevel()) { |
| bailout('Cannot process non top-level $element'); |
| } |