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 * Helps dealing with reflection in the case that the source code has been | 5 * Helps dealing with reflection in the case that the source code has been |
6 * changed as a result of compiling with dart2dart. | 6 * changed as a result of compiling with dart2dart. |
7 */ | 7 */ |
8 library _mirror_helper; | 8 library _mirror_helper; |
9 | 9 |
10 import 'dart:mirrors'; | 10 import 'dart:mirrors'; |
11 | 11 |
12 /// The compiler will replace this variable with a map containing all the | 12 /// The compiler will replace this variable with a map containing all the |
13 /// renames made in dart2dart. | 13 /// renames made in dart2dart. |
14 const Map<String, String> _SYMBOLS = null; | 14 const Map<String, String> _SYMBOLS = null; |
15 | 15 |
16 /// This method is a wrapper for MirrorSystem.getName() and will be inlined and | 16 /// This method is a wrapper for MirrorSystem.getName() and will be inlined and |
17 /// called in the generated output Dart code. | 17 /// called in the generated output Dart code. |
18 String helperGetName(Symbol sym) { | 18 String helperGetName(Symbol sym) { |
19 var name = MirrorSystem.getName(sym); | 19 var name = MirrorSystem.getName(sym); |
20 if (_SYMBOLS.containsKey(name)) { | 20 if (_SYMBOLS.containsKey(name)) { |
21 return _SYMBOLS[name]; | 21 return _SYMBOLS[name]; |
22 } else { | 22 } else { |
23 return name; | 23 return name; |
24 } | 24 } |
25 } | 25 } |
OLD | NEW |