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:_js_primitives' show printString; | 5 import 'dart:_js_primitives' show printString; |
6 import 'dart:_js_helper' show patch; | 6 import 'dart:_js_helper' show patch; |
7 import 'dart:_interceptors' show JSArray; | 7 import 'dart:_interceptors' show JSArray; |
| 8 import 'dart:_foreign_helper' show JS; |
8 | 9 |
9 @patch | 10 @patch |
10 class Symbol implements core.Symbol { | 11 class Symbol implements core.Symbol { |
11 @patch | 12 @patch |
12 const Symbol(String name) | 13 const Symbol(String name) |
13 : this._name = name; | 14 : this._name = name; |
| 15 |
| 16 @patch |
| 17 int get hashCode { |
| 18 int hash = JS('int|Null', '#._hashCode', this); |
| 19 if (hash != null) return hash; |
| 20 const arbitraryPrime = 664597; |
| 21 hash = 0x1fffffff & (arbitraryPrime * _name.hashCode); |
| 22 JS('', '#._hashCode = #', this, hash); |
| 23 return hash; |
| 24 } |
14 } | 25 } |
15 | 26 |
16 @patch | 27 @patch |
17 void printToConsole(String line) { | 28 void printToConsole(String line) { |
18 printString('$line'); | 29 printString('$line'); |
19 } | 30 } |
20 | 31 |
21 @patch | 32 @patch |
22 List/*<E>*/ makeListFixedLength/*<E>*/(List/*<E>*/ growableList) { | 33 List/*<E>*/ makeListFixedLength/*<E>*/(List/*<E>*/ growableList) { |
23 JSArray.markFixedList(growableList); | 34 JSArray.markFixedList(growableList); |
24 return growableList; | 35 return growableList; |
25 } | 36 } |
26 | 37 |
27 @patch | 38 @patch |
28 List/*<E>*/ makeFixedListUnmodifiable/*<E>*/(List/*<E>*/ fixedLengthList) { | 39 List/*<E>*/ makeFixedListUnmodifiable/*<E>*/(List/*<E>*/ fixedLengthList) { |
29 JSArray.markUnmodifiableList(fixedLengthList); | 40 JSArray.markUnmodifiableList(fixedLengthList); |
30 return fixedLengthList; | 41 return fixedLengthList; |
31 } | 42 } |
OLD | NEW |