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