| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of masks; | 5 part of masks; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A [DictionaryTypeMask] is a [TypeMask] for a specific allocation | 8 * A [DictionaryTypeMask] is a [TypeMask] for a specific allocation |
| 9 * site of a map (currently only internal Map class) that is used as | 9 * site of a map (currently only internal Map class) that is used as |
| 10 * a dictionary, i.e. a mapping from a set of statically known strings | 10 * a dictionary, i.e. a mapping from a set of statically known strings |
| 11 * to values. These typemasks only come into existence after the | 11 * to values. These typemasks only come into existence after the |
| 12 * [TypeGraphInferrer] has successfully identified such a usage. Otherwise, | 12 * [TypeGraphInferrer] has successfully identified such a usage. Otherwise, |
| 13 * the more general [MapTypeMask] is used. | 13 * the more general [MapTypeMask] is used. |
| 14 */ | 14 */ |
| 15 class DictionaryTypeMask extends MapTypeMask { | 15 class DictionaryTypeMask extends MapTypeMask { |
| 16 // The underlying key/value map of this dictionary. | 16 // The underlying key/value map of this dictionary. |
| 17 final Map<String, TypeMask> typeMap; | 17 final Map<String, TypeMask> typeMap; |
| 18 | 18 |
| 19 DictionaryTypeMask(forwardTo, allocationNode, allocationElement, keyType, | 19 DictionaryTypeMask( |
| 20 valueType, this.typeMap) | 20 TypeMask forwardTo, |
| 21 Node allocationNode, |
| 22 MemberEntity allocationElement, |
| 23 TypeMask keyType, |
| 24 TypeMask valueType, |
| 25 this.typeMap) |
| 21 : super(forwardTo, allocationNode, allocationElement, keyType, valueType); | 26 : super(forwardTo, allocationNode, allocationElement, keyType, valueType); |
| 22 | 27 |
| 23 TypeMask nullable() { | 28 TypeMask nullable() { |
| 24 return isNullable | 29 return isNullable |
| 25 ? this | 30 ? this |
| 26 : new DictionaryTypeMask(forwardTo.nullable(), allocationNode, | 31 : new DictionaryTypeMask(forwardTo.nullable(), allocationNode, |
| 27 allocationElement, keyType, valueType, typeMap); | 32 allocationElement, keyType, valueType, typeMap); |
| 28 } | 33 } |
| 29 | 34 |
| 30 TypeMask nonNullable() { | 35 TypeMask nonNullable() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 bool operator ==(other) => super == other; | 100 bool operator ==(other) => super == other; |
| 96 | 101 |
| 97 int get hashCode { | 102 int get hashCode { |
| 98 return computeHashCode(allocationNode, isNullable, typeMap, forwardTo); | 103 return computeHashCode(allocationNode, isNullable, typeMap, forwardTo); |
| 99 } | 104 } |
| 100 | 105 |
| 101 String toString() { | 106 String toString() { |
| 102 return 'Dictionary mask: [$keyType/$valueType with $typeMap] type: $forwardT
o'; | 107 return 'Dictionary mask: [$keyType/$valueType with $typeMap] type: $forwardT
o'; |
| 103 } | 108 } |
| 104 } | 109 } |
| OLD | NEW |