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 const String MIRROR_HELPER_LIBRARY_NAME = '_mirror_helper'; |
10 static const String MIRROR_HELPER_SYMBOLS_MAP_NAME = '_SYMBOLS'; | 10 static const String MIRROR_HELPER_SYMBOLS_MAP_NAME = '_SYMBOLS'; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if (!first) { | 80 if (!first) { |
81 sb.write(','); | 81 sb.write(','); |
82 } else { | 82 } else { |
83 first = false; | 83 first = false; |
84 } | 84 } |
85 sb.write("'$mangledName' : '"); | 85 sb.write("'$mangledName' : '"); |
86 sb.write(symbols[mangledName]); | 86 sb.write(symbols[mangledName]); |
87 sb.write("'"); | 87 sb.write("'"); |
88 } | 88 } |
89 sb.write('};'); | 89 sb.write('};'); |
| 90 sb.writeCharCode(0); // Terminate the string with '0', see [StringScanner]. |
90 topLevelNodes.add(parse(sb.toString())); | 91 topLevelNodes.add(parse(sb.toString())); |
91 | 92 |
92 // Replace calls to Mirrorsystem.getName with calls to helper function. | 93 // Replace calls to Mirrorsystem.getName with calls to helper function. |
93 mirrorSystemGetNameNodes.forEach((node) { | 94 mirrorSystemGetNameNodes.forEach((node) { |
94 renames[node.selector] = renames[mirrorHelperGetNameFunctionNode.name]; | 95 renames[node.selector] = renames[mirrorHelperGetNameFunctionNode.name]; |
95 renames[node.receiver] = ''; | 96 renames[node.receiver] = ''; |
96 }); | 97 }); |
97 } | 98 } |
98 } | 99 } |
OLD | NEW |