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

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

Issue 21339002: Rename MirrorSystem.getName calls in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Format TODO comments. Created 7 years, 4 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5d27dc06acb14ca06ab916234b8169127b6eb543..9f4c8163c6da1d4e551259836acbe9b0df7020a9 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
@@ -122,6 +122,12 @@ 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.
+ // Right now, it is set by the tests.
+ bool useMirrorHelperLibrary = false;
Map<Element, TreeElements> get resolvedElements =>
compiler.enqueuer.resolution.resolvedElements;
@@ -171,6 +177,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 +404,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 +438,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 +449,10 @@ class DartBackend extends Backend {
}
}
+ if (useMirrorHelperLibrary && compiler.mirrorsLibrary != null) {
+ MirrorRenamer.addMirrorHelperImport(imports);
+ }
+
final unparser = new EmitterUnparser(renames);
emitCode(unparser, imports, topLevelNodes, memberNodes);
compiler.assembledCode = unparser.result;
@@ -468,6 +478,12 @@ class DartBackend extends Backend {
}
log(String message) => compiler.log('[DartBackend] $message');
+
+ void registerStaticSend(Element element, Node node) {
+ if (useMirrorHelperLibrary && compiler.mirrorsLibrary != null) {
+ MirrorRenamer.handleStaticSend(renames, element, node, compiler);
+ }
+ }
}
class EmitterUnparser extends Unparser {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698