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

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

Issue 21339002: Rename MirrorSystem.getName calls in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..309eb30024913ac135d60e5bd26f71a8f1cf49f2
--- /dev/null
+++ b/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+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_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 void handleStaticSend(Map<Node, String> renames, Element element,
+ Send node, Compiler compiler) {
+ if (element == compiler.mirrorSystemGetNameFunction) {
+ renames[node.selector] = MIRROR_HELPER_GET_NAME_FUNCTION;
+ renames[node.receiver] = MIRROR_HELPER_CLASS_FULLY_QUALIFIED_NAME;
+ }
+ }
+
+ static void addMirrorHelperImport(Map<LibraryElement, String> imports) {
+ Uri mirrorHelperUri = new Uri(path: MIRROR_HELPER_LIBRARY_NAME);
+ //TODO(zarah) Remove this hack! LibraryElementX should not be created
ahe 2013/08/08 12:24:06 Add space after // and add a colon.
zarah 2013/08/08 12:53:35 Done.
+ // outside the library loader. When actual mirror helper library
ahe 2013/08/08 12:24:06 Only one space.
zarah 2013/08/08 12:53:35 Done.
+ // is created, change to load that.
ahe 2013/08/08 12:24:06 Ditto.
zarah 2013/08/08 12:53:35 Done.
+ LibraryElement mirrorHelperLib = new LibraryElementX(
+ new Script(mirrorHelperUri, null));
+ imports.putIfAbsent(mirrorHelperLib, () => MIRROR_HELPER_LIBRARY_PREFIX);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698