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

Unified Diff: sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart

Issue 22791002: Add renames in output when using the mirror helper library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
Index: sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart b/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart
index 003dda44768370e4daaa8994d6ab2ca587f32386..816c1883ac46fe5f9264c741df1608b77e2b3890 100644
--- a/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart
@@ -7,11 +7,15 @@ part of mirror_renamer;
class MirrorRenamer {
static const String MIRROR_HELPER_CLASS = 'MirrorHelper';
static const String MIRROR_HELPER_GET_NAME_FUNCTION = 'getName';
+ static const String MIRROR_HELPER_ADD_RENAME_FUNCTION = 'addRename';
+
static const String MIRROR_HELPER_LIBRARY_NAME = 'mirror_helper.dart';
static const String MIRROR_HELPER_LIBRARY_PREFIX = 'm';
static const String MIRROR_HELPER_CLASS_FULLY_QUALIFIED_NAME =
'$MIRROR_HELPER_LIBRARY_PREFIX.$MIRROR_HELPER_CLASS';
+ static Map<String, String> inverseRenames;
+
static void handleStaticSend(Map<Node, String> renames, Element element,
Send node, Compiler compiler) {
if (element == compiler.mirrorSystemGetNameFunction) {
@@ -29,4 +33,17 @@ class MirrorRenamer {
new Script(mirrorHelperUri, null));
imports.putIfAbsent(mirrorHelperLib, () => MIRROR_HELPER_LIBRARY_PREFIX);
}
+
+ static void registerRenames(Map<Node, String> renames) {
+ inverseRenames = new Map<String, String>();
+
+ for (Node node in renames.keys) {
+ if (node is Identifier) {
+ var stringValue = node.asIdentifier().source.stringValue;
+ if (stringValue != renames[node]) {
+ inverseRenames.putIfAbsent(renames[node], () => stringValue);
+ }
+ }
+ }
+ }
}

Powered by Google App Engine
This is Rietveld 408576698