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; |
| 6 |
5 @patch class Symbol { | 7 @patch class Symbol { |
6 @patch const Symbol(String name) | 8 @patch const Symbol(String name) |
7 : this._name = name; | 9 : this._name = name; |
8 | 10 |
9 @patch toString() => 'Symbol("${getUnmangledName(this)}")'; | 11 @patch toString() => 'Symbol("${getUnmangledName(this)}")'; |
10 | 12 |
11 static getUnmangledName(Symbol symbol) { | 13 static getUnmangledName(Symbol symbol) { |
12 String string = Symbol.getName(symbol); | 14 String string = Symbol.getName(symbol); |
13 | 15 |
14 // Remove closurization hash mark | 16 // Remove closurization hash mark |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 result.write('='); | 52 result.write('='); |
51 } | 53 } |
52 return result.toString(); | 54 return result.toString(); |
53 } | 55 } |
54 | 56 |
55 @patch int get hashCode { | 57 @patch int get hashCode { |
56 const arbitraryPrime = 664597; | 58 const arbitraryPrime = 664597; |
57 return 0x1fffffff & (arbitraryPrime * _name.hashCode); | 59 return 0x1fffffff & (arbitraryPrime * _name.hashCode); |
58 } | 60 } |
59 } | 61 } |
OLD | NEW |