| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 part of types; | |
| 6 | |
| 7 class ValueTypeMask extends ForwardingTypeMask { | |
| 8 final TypeMask forwardTo; | |
| 9 final value; | |
| 10 | |
| 11 ValueTypeMask(this.forwardTo, this.value); | |
| 12 | |
| 13 TypeMask nullable() { | |
| 14 return isNullable | |
| 15 ? this | |
| 16 : new ValueTypeMask(forwardTo.nullable(), value); | |
| 17 } | |
| 18 | |
| 19 TypeMask nonNullable() { | |
| 20 return isNullable | |
| 21 ? new ValueTypeMask(forwardTo.nonNullable(), value) | |
| 22 : this; | |
| 23 } | |
| 24 | |
| 25 bool get isValue => true; | |
| 26 | |
| 27 bool equalsDisregardNull(other) { | |
| 28 if (other is! ValueTypeMask) return false; | |
| 29 return super.equalsDisregardNull(other) && value == other.value; | |
| 30 } | |
| 31 | |
| 32 TypeMask intersection(TypeMask other, ClassWorld classWorld) { | |
| 33 TypeMask forwardIntersection = forwardTo.intersection(other, classWorld); | |
| 34 if (forwardIntersection.isEmpty) return forwardIntersection; | |
| 35 return forwardIntersection.isNullable | |
| 36 ? nullable() | |
| 37 : nonNullable(); | |
| 38 } | |
| 39 | |
| 40 bool operator==(other) => super == other; | |
| 41 | |
| 42 int get hashCode { | |
| 43 return computeHashCode(value, isNullable, forwardTo); | |
| 44 } | |
| 45 | |
| 46 String toString() { | |
| 47 return 'Value mask: [$value] type: $forwardTo'; | |
| 48 } | |
| 49 } | |
| OLD | NEW |