| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 part of mirror_renamer; |
| 6 |
| 7 class MirrorRenamer { |
| 8 static const String MIRROR_HELPER_CLASS = 'MirrorHelper'; |
| 9 static const String MIRROR_HELPER_GET_NAME_FUNCTION = 'getName'; |
| 10 static const String MIRROR_HELPER_LIBRARY_NAME = 'mirror_helper.dart'; |
| 11 static const String MIRROR_HELPER_LIBRARY_PREFIX = 'm'; |
| 12 static const String MIRROR_HELPER_CLASS_FULLY_QUALIFIED_NAME = |
| 13 '$MIRROR_HELPER_LIBRARY_PREFIX.$MIRROR_HELPER_CLASS'; |
| 14 |
| 15 static void handleStaticSend(Map<Node, String> renames, Element element, |
| 16 Send node, Compiler compiler) { |
| 17 if (element == compiler.mirrorSystemGetNameFunction) { |
| 18 renames[node.selector] = MIRROR_HELPER_GET_NAME_FUNCTION; |
| 19 renames[node.receiver] = MIRROR_HELPER_CLASS_FULLY_QUALIFIED_NAME; |
| 20 } |
| 21 } |
| 22 |
| 23 static void addMirrorHelperImport(Map<LibraryElement, String> imports) { |
| 24 Uri mirrorHelperUri = new Uri(path: MIRROR_HELPER_LIBRARY_NAME); |
| 25 // TODO(zarah): Remove this hack! LibraryElementX should not be created |
| 26 // outside the library loader. When actual mirror helper library |
| 27 // is created, change to load that. |
| 28 LibraryElement mirrorHelperLib = new LibraryElementX( |
| 29 new Script(mirrorHelperUri, null)); |
| 30 imports.putIfAbsent(mirrorHelperLib, () => MIRROR_HELPER_LIBRARY_PREFIX); |
| 31 } |
| 32 } |
| OLD | NEW |