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

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 comments and added tests. Created 7 years, 5 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..a9328ac7ece32894666366b18d39210e185ba8f8
--- /dev/null
+++ b/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart
@@ -0,0 +1,30 @@
+// 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 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_LIBRARY_PREFIX.$MIRROR_HELPER_CLASS';
ahe 2013/08/06 15:53:36 This could be a constant as well.
zarah 2013/08/08 12:17:10 Done.
+ }
+ }
+
+ static void addMirrorHelperImport(Map<LibraryElement, String> imports) {
+ Uri mirrorHelperUri = new Uri(path: MIRROR_HELPER_LIBRARY_NAME);
+ //TODO(zarah) When actual mirror helper library is created
+ // change to load that.
+ LibraryElement mirrorHelperLib = new LibraryElementX(
+ new Script(mirrorHelperUri, null));
ahe 2013/08/06 15:53:36 I'm really not comfortable that you instantiate Li
zarah 2013/08/08 12:17:10 Done.
+ imports.putIfAbsent(mirrorHelperLib, () => MIRROR_HELPER_LIBRARY_PREFIX);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698