OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 types; | 5 part of types; |
6 | 6 |
7 /** | 7 /** |
8 * A type mask that wraps an other one, and delegate all its | 8 * A type mask that wraps an other one, and delegate all its |
9 * implementation methods to it. | 9 * implementation methods to it. |
10 */ | 10 */ |
11 abstract class ForwardingTypeMask implements TypeMask { | 11 abstract class ForwardingTypeMask implements TypeMask { |
12 | |
13 TypeMask get forwardTo; | 12 TypeMask get forwardTo; |
14 | 13 |
15 ForwardingTypeMask(); | 14 ForwardingTypeMask(); |
16 | 15 |
17 bool get isEmptyOrNull => forwardTo.isEmptyOrNull; | 16 bool get isEmptyOrNull => forwardTo.isEmptyOrNull; |
18 bool get isEmpty => forwardTo.isEmpty; | 17 bool get isEmpty => forwardTo.isEmpty; |
19 bool get isNullable => forwardTo.isNullable; | 18 bool get isNullable => forwardTo.isNullable; |
20 bool get isNull => forwardTo.isNull; | 19 bool get isNull => forwardTo.isNull; |
21 bool get isExact => forwardTo.isExact; | 20 bool get isExact => forwardTo.isExact; |
22 | 21 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 94 } |
96 | 95 |
97 bool needsNoSuchMethodHandling(Selector selector, ClassWorld classWorld) { | 96 bool needsNoSuchMethodHandling(Selector selector, ClassWorld classWorld) { |
98 return forwardTo.needsNoSuchMethodHandling(selector, classWorld); | 97 return forwardTo.needsNoSuchMethodHandling(selector, classWorld); |
99 } | 98 } |
100 | 99 |
101 bool canHit(Element element, Selector selector, ClassWorld classWorld) { | 100 bool canHit(Element element, Selector selector, ClassWorld classWorld) { |
102 return forwardTo.canHit(element, selector, classWorld); | 101 return forwardTo.canHit(element, selector, classWorld); |
103 } | 102 } |
104 | 103 |
105 Element locateSingleElement(Selector selector, | 104 Element locateSingleElement( |
106 TypeMask mask, | 105 Selector selector, TypeMask mask, Compiler compiler) { |
107 Compiler compiler) { | |
108 return forwardTo.locateSingleElement(selector, mask, compiler); | 106 return forwardTo.locateSingleElement(selector, mask, compiler); |
109 } | 107 } |
110 | 108 |
111 bool equalsDisregardNull(other) { | 109 bool equalsDisregardNull(other) { |
112 if (other is! ForwardingTypeMask) return false; | 110 if (other is! ForwardingTypeMask) return false; |
113 if (forwardTo.isNullable) { | 111 if (forwardTo.isNullable) { |
114 return forwardTo == other.forwardTo.nullable(); | 112 return forwardTo == other.forwardTo.nullable(); |
115 } else { | 113 } else { |
116 return forwardTo == other.forwardTo.nonNullable(); | 114 return forwardTo == other.forwardTo.nonNullable(); |
117 } | 115 } |
118 } | 116 } |
119 | 117 |
120 bool operator==(other) { | 118 bool operator ==(other) { |
121 return equalsDisregardNull(other) && isNullable == other.isNullable; | 119 return equalsDisregardNull(other) && isNullable == other.isNullable; |
122 } | 120 } |
123 | 121 |
124 int get hashCode => throw "Subclass should implement hashCode getter"; | 122 int get hashCode => throw "Subclass should implement hashCode getter"; |
125 } | 123 } |
OLD | NEW |