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

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: Implement hashCode and equals 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..b70a661135e1174a2b76c8637360a38a091ef1d8 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 _name == _name;
kasperl 2013/04/11 11:37:00 Check that other is a symbol and that _name == oth
ahe 2013/04/11 11:47:50 Done.
+ }
+
+ patch int get hashCode {
+ const arbitraryPrime = 664597;
+ return 0x1fffffff & (arbitraryPrime * _name.hashCode);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698