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 | 14 // Remove closurization hash mark |
15 // #foo -> foo | 15 // #foo -> foo |
16 if (string.startsWith('#')) { | 16 if (string.startsWith('#')) { |
17 string = string.substring(1); | 17 string = string.substring(1); |
18 } | 18 } |
19 // get:foo -> foo | 19 // get:foo -> foo |
(...skipping 25 matching lines...) Expand all Loading... |
45 if (!skip) { | 45 if (!skip) { |
46 result.write(char); | 46 result.write(char); |
47 } | 47 } |
48 } | 48 } |
49 if (add_setter_suffix) { | 49 if (add_setter_suffix) { |
50 result.write('='); | 50 result.write('='); |
51 } | 51 } |
52 return result.toString(); | 52 return result.toString(); |
53 } | 53 } |
54 | 54 |
55 /* @patch */ int get hashCode { | 55 @patch int get hashCode { |
56 const arbitraryPrime = 664597; | 56 const arbitraryPrime = 664597; |
57 return 0x1fffffff & (arbitraryPrime * _name.hashCode); | 57 return 0x1fffffff & (arbitraryPrime * _name.hashCode); |
58 } | 58 } |
59 } | 59 } |
OLD | NEW |