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 import 'dart:core' hide Symbol; | 5 import 'dart:core' hide Symbol; |
6 | 6 |
7 @patch class Symbol { | 7 @patch |
8 @patch const Symbol(String name) | 8 class Symbol { |
9 : this._name = name; | 9 @patch |
| 10 const Symbol(String name) : this._name = name; |
10 | 11 |
11 @patch toString() => 'Symbol("${getUnmangledName(this)}")'; | 12 @patch |
| 13 toString() => 'Symbol("${getUnmangledName(this)}")'; |
12 | 14 |
13 static getUnmangledName(Symbol symbol) { | 15 static getUnmangledName(Symbol symbol) { |
14 String string = Symbol.getName(symbol); | 16 String string = Symbol.getName(symbol); |
15 | 17 |
16 // Remove closurization hash mark | 18 // Remove closurization hash mark |
17 // #foo -> foo | 19 // #foo -> foo |
18 if (string.startsWith('#')) { | 20 if (string.startsWith('#')) { |
19 string = string.substring(1); | 21 string = string.substring(1); |
20 } | 22 } |
21 // get:foo -> foo | 23 // get:foo -> foo |
(...skipping 25 matching lines...) Expand all Loading... |
47 if (!skip) { | 49 if (!skip) { |
48 result.write(char); | 50 result.write(char); |
49 } | 51 } |
50 } | 52 } |
51 if (add_setter_suffix) { | 53 if (add_setter_suffix) { |
52 result.write('='); | 54 result.write('='); |
53 } | 55 } |
54 return result.toString(); | 56 return result.toString(); |
55 } | 57 } |
56 | 58 |
57 @patch int get hashCode { | 59 @patch |
| 60 int get hashCode { |
58 const arbitraryPrime = 664597; | 61 const arbitraryPrime = 664597; |
59 return 0x1fffffff & (arbitraryPrime * _name.hashCode); | 62 return 0x1fffffff & (arbitraryPrime * _name.hashCode); |
60 } | 63 } |
61 } | 64 } |
OLD | NEW |