| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 */ | 262 */ |
| 263 class ArgumentsTypes<T> extends IterableMixin<T> { | 263 class ArgumentsTypes<T> extends IterableMixin<T> { |
| 264 final List<T> positional; | 264 final List<T> positional; |
| 265 final Map<String, T> named; | 265 final Map<String, T> named; |
| 266 ArgumentsTypes(this.positional, named) | 266 ArgumentsTypes(this.positional, named) |
| 267 : this.named = (named == null || named.isEmpty) ? const {} : named { | 267 : this.named = (named == null || named.isEmpty) ? const {} : named { |
| 268 assert(this.positional.every((T type) => type != null)); | 268 assert(this.positional.every((T type) => type != null)); |
| 269 assert(this.named.values.every((T type) => type != null)); | 269 assert(this.named.values.every((T type) => type != null)); |
| 270 } | 270 } |
| 271 | 271 |
| 272 ArgumentsTypes.empty() : positional = const [], named = const {}; | |
| 273 | |
| 274 int get length => positional.length + named.length; | 272 int get length => positional.length + named.length; |
| 275 | 273 |
| 276 Iterator<T> get iterator => new ArgumentsTypesIterator(this); | 274 Iterator<T> get iterator => new ArgumentsTypesIterator(this); |
| 277 | 275 |
| 278 String toString() => "{ positional = $positional, named = $named }"; | 276 String toString() => "{ positional = $positional, named = $named }"; |
| 279 | 277 |
| 280 bool operator==(other) { | 278 bool operator==(other) { |
| 281 if (positional.length != other.positional.length) return false; | 279 if (positional.length != other.positional.length) return false; |
| 282 if (named.length != other.named.length) return false; | 280 if (named.length != other.named.length) return false; |
| 283 for (int i = 0; i < positional.length; i++) { | 281 for (int i = 0; i < positional.length; i++) { |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 T visitSuperSend(Send node); | 706 T visitSuperSend(Send node); |
| 709 | 707 |
| 710 T visitStaticSend(Send node); | 708 T visitStaticSend(Send node); |
| 711 | 709 |
| 712 T visitGetterSend(Send node); | 710 T visitGetterSend(Send node); |
| 713 | 711 |
| 714 T visitClosureSend(Send node); | 712 T visitClosureSend(Send node); |
| 715 | 713 |
| 716 T visitDynamicSend(Send node); | 714 T visitDynamicSend(Send node); |
| 717 | 715 |
| 718 T visitAsyncForIn(AsyncForIn node); | 716 T visitForIn(ForIn node); |
| 719 | |
| 720 T visitSyncForIn(SyncForIn node); | |
| 721 | 717 |
| 722 T visitReturn(Return node); | 718 T visitReturn(Return node); |
| 723 | 719 |
| 724 T visitFunctionExpression(FunctionExpression node); | 720 T visitFunctionExpression(FunctionExpression node); |
| 725 | 721 |
| 726 T visitAssertSend(Send node) { | 722 T visitAssertSend(Send node) { |
| 727 if (!compiler.enableUserAssertions) { | 723 if (!compiler.enableUserAssertions) { |
| 728 return types.nullType; | 724 return types.nullType; |
| 729 } | 725 } |
| 730 // TODO(johnniwinther): Don't handle assert like a regular static call since | 726 // TODO(johnniwinther): Don't handle assert like a regular static call since |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 return type; | 1301 return type; |
| 1306 } | 1302 } |
| 1307 | 1303 |
| 1308 T visitCascade(Cascade node) { | 1304 T visitCascade(Cascade node) { |
| 1309 // Ignore the result of the cascade send and return the type of the cascade | 1305 // Ignore the result of the cascade send and return the type of the cascade |
| 1310 // receiver. | 1306 // receiver. |
| 1311 visit(node.expression); | 1307 visit(node.expression); |
| 1312 return cascadeReceiverStack.removeLast(); | 1308 return cascadeReceiverStack.removeLast(); |
| 1313 } | 1309 } |
| 1314 } | 1310 } |
| OLD | NEW |