Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart |
| index 4c29888220cbbf0135c41aa9753413b59d7506be..abfc95058266d7163afc43ead48f734c08da71dc 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart |
| @@ -122,6 +122,11 @@ class DartBackend extends Backend { |
| final bool stripAsserts; |
| // TODO(antonm): make available from command-line options. |
| final bool outputAst = false; |
| + final Map<Node, String> renames; |
| + final Map<LibraryElement, String> imports; |
| + final Map<ClassNode, List<Node>> memberNodes; |
| + // TODO(zarah) Maybe change this to a command-line option; |
| + bool mirrorHelping = false; |
|
ahe
2013/08/06 15:53:36
Could you make the name a little more descriptive?
zarah
2013/08/08 12:17:10
Done.
|
| Map<Element, TreeElements> get resolvedElements => |
| compiler.enqueuer.resolution.resolvedElements; |
| @@ -171,6 +176,9 @@ class DartBackend extends Backend { |
| DartBackend(Compiler compiler, List<String> strips) |
| : tasks = <CompilerTask>[], |
| + renames = new Map<Node, String>(), |
| + imports = new Map<LibraryElement, String>(), |
| + memberNodes = new Map<ClassNode, List<Node>>(), |
| forceStripTypes = strips.indexOf('types') != -1, |
| stripAsserts = strips.indexOf('asserts') != -1, |
| super(compiler); |
| @@ -395,8 +403,6 @@ class DartBackend extends Backend { |
| } |
| topLevelElements.forEach(makePlaceholders); |
| // Create renames. |
| - Map<Node, String> renames = new Map<Node, String>(); |
| - Map<LibraryElement, String> imports = new Map<LibraryElement, String>(); |
| bool shouldCutDeclarationTypes = forceStripTypes |
| || (compiler.enableMinification |
| && isSafeToRemoveTypeDeclarations(classMembers)); |
| @@ -431,7 +437,6 @@ class DartBackend extends Backend { |
| } |
| final topLevelNodes = <Node>[]; |
| - final memberNodes = new Map<ClassNode, List<Node>>(); |
| for (final element in sortedTopLevels) { |
| topLevelNodes.add(elementAsts[element].ast); |
| if (element.isClass() && !element.isMixinApplication) { |
| @@ -443,6 +448,10 @@ class DartBackend extends Backend { |
| } |
| } |
| + if (mirrorHelping && compiler.mirrorsLibrary != null) { |
| + MirrorRenamer.addMirrorHelperImport(imports); |
| + } |
| + |
| final unparser = new EmitterUnparser(renames); |
| emitCode(unparser, imports, topLevelNodes, memberNodes); |
| compiler.assembledCode = unparser.result; |
| @@ -468,6 +477,13 @@ class DartBackend extends Backend { |
| } |
| log(String message) => compiler.log('[DartBackend] $message'); |
| + |
| + void registerStaticSend(Element element, Node node) { |
| + if (mirrorHelping && compiler.mirrorsLibrary != null) { |
| + MirrorRenamer.handleStaticSend(renames, element, node, compiler); |
| + } |
| + } |
| + |
|
ahe
2013/08/06 15:53:36
Extra line.
zarah
2013/08/08 12:17:10
Done.
|
| } |
| class EmitterUnparser extends Unparser { |