| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of mirror_renamer; | 5 part of mirror_renamer; |
| 6 | 6 |
| 7 class MirrorRenamer { | 7 class MirrorRenamer { |
| 8 static const String MIRROR_HELPER_GET_NAME_FUNCTION = 'helperGetName'; | 8 static const String MIRROR_HELPER_GET_NAME_FUNCTION = 'helperGetName'; |
| 9 static const String MIRROR_HELPER_LIBRARY_NAME = '_mirror_helper'; | 9 static final Uri DART_MIRROR_HELPER = |
| 10 new Uri(scheme: 'dart', path: '_mirror_helper'); |
| 10 static const String MIRROR_HELPER_SYMBOLS_MAP_NAME = '_SYMBOLS'; | 11 static const String MIRROR_HELPER_SYMBOLS_MAP_NAME = '_SYMBOLS'; |
| 11 | 12 |
| 12 /// Maps mangled name to original name. | 13 /// Maps mangled name to original name. |
| 13 Map<String, String> symbols = new Map<String, String>(); | 14 Map<String, String> symbols = new Map<String, String>(); |
| 14 /// Contains all occurrencs of MirrorSystem.getName() calls in the user code. | 15 /// Contains all occurrencs of MirrorSystem.getName() calls in the user code. |
| 15 List<Node> mirrorSystemGetNameNodes = <Node>[]; | 16 List<Node> mirrorSystemGetNameNodes = <Node>[]; |
| 16 /** | 17 /** |
| 17 * Initialized when the placeholderCollector collects the FunctionElement | 18 * Initialized when the placeholderCollector collects the FunctionElement |
| 18 * backend.mirrorHelperGetNameFunction which represents the helperGetName | 19 * backend.mirrorHelperGetNameFunction which represents the helperGetName |
| 19 * function in _mirror_helper. | 20 * function in _mirror_helper. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 sb.writeCharCode(0); // Terminate the string with '0', see [StringScanner]. | 91 sb.writeCharCode(0); // Terminate the string with '0', see [StringScanner]. |
| 91 topLevelNodes.add(parse(sb.toString())); | 92 topLevelNodes.add(parse(sb.toString())); |
| 92 | 93 |
| 93 // Replace calls to Mirrorsystem.getName with calls to helper function. | 94 // Replace calls to Mirrorsystem.getName with calls to helper function. |
| 94 mirrorSystemGetNameNodes.forEach((node) { | 95 mirrorSystemGetNameNodes.forEach((node) { |
| 95 renames[node.selector] = renames[mirrorHelperGetNameFunctionNode.name]; | 96 renames[node.selector] = renames[mirrorHelperGetNameFunctionNode.name]; |
| 96 renames[node.receiver] = ''; | 97 renames[node.receiver] = ''; |
| 97 }); | 98 }); |
| 98 } | 99 } |
| 99 } | 100 } |
| OLD | NEW |