Chromium Code Reviews| 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 | |
| 13 static void handleStaticSend(Map<Node, String> renames, Element element, | |
| 14 Send node, Compiler compiler) { | |
| 15 if (element == compiler.mirrorSystemGetNameFunction) { | |
| 16 renames[node.selector] = MIRROR_HELPER_GET_NAME_FUNCTION; | |
| 17 renames[node.receiver] = | |
| 18 '$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.
| |
| 19 } | |
| 20 } | |
| 21 | |
| 22 static void addMirrorHelperImport(Map<LibraryElement, String> imports) { | |
| 23 Uri mirrorHelperUri = new Uri(path: MIRROR_HELPER_LIBRARY_NAME); | |
| 24 //TODO(zarah) When actual mirror helper library is created | |
| 25 // change to load that. | |
| 26 LibraryElement mirrorHelperLib = new LibraryElementX( | |
| 27 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.
| |
| 28 imports.putIfAbsent(mirrorHelperLib, () => MIRROR_HELPER_LIBRARY_PREFIX); | |
| 29 } | |
| 30 } | |
| OLD | NEW |