| 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) : this._name = name; |
| 14 : this._name = name; | |
| 15 | 14 |
| 16 @patch | 15 @patch |
| 17 int get hashCode { | 16 int get hashCode { |
| 18 int hash = JS('int|Null', '#._hashCode', this); | 17 int hash = JS('int|Null', '#._hashCode', this); |
| 19 if (hash != null) return hash; | 18 if (hash != null) return hash; |
| 20 const arbitraryPrime = 664597; | 19 const arbitraryPrime = 664597; |
| 21 hash = 0x1fffffff & (arbitraryPrime * _name.hashCode); | 20 hash = 0x1fffffff & (arbitraryPrime * _name.hashCode); |
| 22 JS('', '#._hashCode = #', this, hash); | 21 JS('', '#._hashCode = #', this, hash); |
| 23 return hash; | 22 return hash; |
| 24 } | 23 } |
| 25 | 24 |
| 26 @patch | 25 @patch |
| 27 toString() => 'Symbol("$_name")'; | 26 toString() => 'Symbol("$_name")'; |
| 28 } | 27 } |
| 29 | 28 |
| 30 @patch | 29 @patch |
| 31 void printToConsole(String line) { | 30 void printToConsole(String line) { |
| 32 printString('$line'); | 31 printString('$line'); |
| 33 } | 32 } |
| 34 | 33 |
| 35 @patch | 34 @patch |
| 36 List makeListFixedLength(List growableList) { | 35 List makeListFixedLength(List growableList) { |
| 37 return JSArray.markFixedList(growableList); | 36 return JSArray.markFixedList(growableList); |
| 38 } | 37 } |
| 39 | 38 |
| 40 @patch | 39 @patch |
| 41 List makeFixedListUnmodifiable(List fixedLengthList) { | 40 List makeFixedListUnmodifiable(List fixedLengthList) { |
| 42 return JSArray.markUnmodifiableList(fixedLengthList); | 41 return JSArray.markUnmodifiableList(fixedLengthList); |
| 43 } | 42 } |
| OLD | NEW |