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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 part of di;
2
3 int _lastKeyId = 0;
4 int get lastKeyId => _lastKeyId;
5
6 Map<int, int> _hashToKey = {};
7
8 class Key {
9 final Type type;
10 final Type annotation;
11 final int hashCode;
12 final int id;
13
14 factory Key(Type type, [Type annotation]) {
15 var _hashCode = type.hashCode + annotation.hashCode;
16 var _id = _hashToKey.putIfAbsent(_hashCode, () => _lastKeyId++);
17 return new Key._newKey(type, annotation, _hashCode, _id);
18 }
19
20 Key._newKey(this.type, this.annotation, this.hashCode, this.id);
21
22 bool operator ==(other) =>
23 other is Key && other.hashCode == hashCode;
24
25 String toString() {
26 String asString = type.toString();
27 if (annotation != null) {
28 asString += ' annotated with: ${annotation.toString()}';
29 }
30 return asString;
31 }
32 }
OLDNEW
« 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