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