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 patch class Symbol { | 5 patch class Symbol { |
6 /* patch */ const Symbol(String name) | 6 /* patch */ const Symbol(String name) |
7 : this._name = name; | 7 : this._name = name; |
8 | 8 |
9 /* patch */ toString() => 'Symbol("${getUnmangledName(this)}")'; | 9 /* patch */ toString() => 'Symbol("${getUnmangledName(this)}")'; |
10 | 10 |
11 static getUnmangledName(Symbol symbol) { | 11 static getUnmangledName(Symbol symbol) { |
12 String string = Symbol.getName(symbol); | 12 String string = Symbol.getName(symbol); |
13 | 13 |
| 14 // Remove closurization hash mark |
| 15 // #foo -> foo |
| 16 if (string.startsWith('#')) { |
| 17 string = string.substring(1); |
| 18 } |
14 // get:foo -> foo | 19 // get:foo -> foo |
15 // set:foo -> foo= | 20 // set:foo -> foo= |
16 // get:_foo@xxx -> _foo | 21 // get:_foo@xxx -> _foo |
17 // set:_foo@xxx -> _foo= | 22 // set:_foo@xxx -> _foo= |
18 // Class._constructor@xxx -> Class._constructor | 23 // Class._constructor@xxx -> Class._constructor |
19 // _Class@xxx._constructor@xxx -> _Class._constructor | 24 // _Class@xxx._constructor@xxx -> _Class._constructor |
20 // lib._S@xxx with lib._M1@xxx, lib._M2@xxx -> lib._S with lib._M1, lib._M2 | 25 // lib._S@xxx with lib._M1@xxx, lib._M2@xxx -> lib._S with lib._M1, lib._M2 |
21 StringBuffer result = new StringBuffer(); | 26 StringBuffer result = new StringBuffer(); |
22 bool add_setter_suffix = false; | 27 bool add_setter_suffix = false; |
23 var pos = 0; | 28 var pos = 0; |
(...skipping 16 matching lines...) Expand all Loading... |
40 if (!skip) { | 45 if (!skip) { |
41 result.write(char); | 46 result.write(char); |
42 } | 47 } |
43 } | 48 } |
44 if (add_setter_suffix) { | 49 if (add_setter_suffix) { |
45 result.write('='); | 50 result.write('='); |
46 } | 51 } |
47 return result.toString(); | 52 return result.toString(); |
48 } | 53 } |
49 } | 54 } |
OLD | NEW |