Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart

Issue 14142003: Add Symbol class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix operator== Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart b/dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
index ec457089287b4236edf12d9ffc42077d0ddfd01a..6569d60ea5489c18b0ad41332af11e55d5f355b6 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
@@ -298,3 +298,19 @@ patch class StackTrace {
throw new UnsupportedError('stackTrace');
}
}
+
+patch class Symbol {
+ final String _name;
+
+ patch const Symbol(String name) :
+ this._name = name;
+
+ patch bool operator ==(other) {
+ return other is Symbol && _name == other._name;
+ }
+
+ patch int get hashCode {
+ const arbitraryPrime = 664597;
+ return 0x1fffffff & (arbitraryPrime * _name.hashCode);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698