Index: sdk/lib/_internal/js_runtime/lib/internal_patch.dart |
diff --git a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart |
index cb8820ce2b85f30b488deea77bc20316ff04a17c..a0c519f89911b2dc39b6f7c479a96888dd8b8529 100644 |
--- a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart |
+++ b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart |
@@ -5,12 +5,23 @@ |
import 'dart:_js_primitives' show printString; |
import 'dart:_js_helper' show patch; |
import 'dart:_interceptors' show JSArray; |
+import 'dart:_foreign_helper' show JS; |
@patch |
class Symbol implements core.Symbol { |
@patch |
const Symbol(String name) |
: this._name = name; |
+ |
+ @patch |
+ int get hashCode { |
+ int hash = JS('int|Null', '#._hashCode', this); |
+ if (hash != null) return hash; |
+ const arbitraryPrime = 664597; |
+ hash = 0x1fffffff & (arbitraryPrime * _name.hashCode); |
+ JS('', '#._hashCode = #', this, hash); |
+ return hash; |
+ } |
} |
@patch |