| OLD | NEW |
| (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 } | |
| OLD | NEW |