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 library inferrer_visitor; | 5 library inferrer_visitor; |
6 | 6 |
7 import '../dart2jslib.dart' hide Selector, TypedSelector; | 7 import '../dart2jslib.dart' hide Selector, TypedSelector; |
8 import '../dart_types.dart'; | 8 import '../dart_types.dart'; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 /** | 219 /** |
220 * Placeholder for inferred arguments types on sends. | 220 * Placeholder for inferred arguments types on sends. |
221 */ | 221 */ |
222 class ArgumentsTypes<T> { | 222 class ArgumentsTypes<T> { |
223 final List<T> positional; | 223 final List<T> positional; |
224 final Map<String, T> named; | 224 final Map<String, T> named; |
225 ArgumentsTypes(this.positional, named) | 225 ArgumentsTypes(this.positional, named) |
226 : this.named = (named == null || named.isEmpty) ? const {} : named; | 226 : this.named = (named == null || named.isEmpty) ? const {} : named { |
| 227 assert(this.positional.every((T type) => type != null)); |
| 228 assert(this.named.values.every((T type) => type != null)); |
| 229 } |
227 | 230 |
228 int get length => positional.length + named.length; | 231 int get length => positional.length + named.length; |
229 | 232 |
230 String toString() => "{ positional = $positional, named = $named }"; | 233 String toString() => "{ positional = $positional, named = $named }"; |
231 | 234 |
232 bool operator==(other) { | 235 bool operator==(other) { |
233 if (positional.length != other.positional.length) return false; | 236 if (positional.length != other.positional.length) return false; |
234 if (named.length != other.named.length) return false; | 237 if (named.length != other.named.length) return false; |
235 for (int i = 0; i < positional.length; i++) { | 238 for (int i = 0; i < positional.length; i++) { |
236 if (positional[i] != other.positional[i]) return false; | 239 if (positional[i] != other.positional[i]) return false; |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 return type; | 1142 return type; |
1140 } | 1143 } |
1141 | 1144 |
1142 T visitCascade(Cascade node) { | 1145 T visitCascade(Cascade node) { |
1143 // Ignore the result of the cascade send and return the type of the cascade | 1146 // Ignore the result of the cascade send and return the type of the cascade |
1144 // receiver. | 1147 // receiver. |
1145 visit(node.expression); | 1148 visit(node.expression); |
1146 return cascadeReceiverStack.removeLast(); | 1149 return cascadeReceiverStack.removeLast(); |
1147 } | 1150 } |
1148 } | 1151 } |
OLD | NEW |