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

Unified Diff: third_party/pkg/di/lib/src/key.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « third_party/pkg/di/lib/src/injector_delagate.dart ('k') | third_party/pkg/di/lib/src/mirrors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/di/lib/src/key.dart
diff --git a/third_party/pkg/di/lib/src/key.dart b/third_party/pkg/di/lib/src/key.dart
new file mode 100644
index 0000000000000000000000000000000000000000..84ba9ad9c23279372f5aa93bd11c20ba8bd9250f
--- /dev/null
+++ b/third_party/pkg/di/lib/src/key.dart
@@ -0,0 +1,32 @@
+part of di;
+
+int _lastKeyId = 0;
+int get lastKeyId => _lastKeyId;
+
+Map<int, int> _hashToKey = {};
+
+class Key {
+ final Type type;
+ final Type annotation;
+ final int hashCode;
+ final int id;
+
+ factory Key(Type type, [Type annotation]) {
+ var _hashCode = type.hashCode + annotation.hashCode;
+ var _id = _hashToKey.putIfAbsent(_hashCode, () => _lastKeyId++);
+ return new Key._newKey(type, annotation, _hashCode, _id);
+ }
+
+ Key._newKey(this.type, this.annotation, this.hashCode, this.id);
+
+ bool operator ==(other) =>
+ other is Key && other.hashCode == hashCode;
+
+ String toString() {
+ String asString = type.toString();
+ if (annotation != null) {
+ asString += ' annotated with: ${annotation.toString()}';
+ }
+ return asString;
+ }
+}
« no previous file with comments | « third_party/pkg/di/lib/src/injector_delagate.dart ('k') | third_party/pkg/di/lib/src/mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698