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 simple_types_inferrer; | 5 library simple_types_inferrer; |
6 | 6 |
7 import '../closure.dart' show ClosureClassMap; | 7 import '../closure.dart' show ClosureClassMap; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/names.dart' show Identifiers, Selectors; | 9 import '../common/names.dart' show Identifiers, Selectors; |
10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2317 } | 2317 } |
2318 if (compiler.backend.isForeign(target)) { | 2318 if (compiler.backend.isForeign(target)) { |
2319 return handleForeignSend(node, target); | 2319 return handleForeignSend(node, target); |
2320 } | 2320 } |
2321 Selector selector = elements.getSelector(node); | 2321 Selector selector = elements.getSelector(node); |
2322 CallStructure callStructure = selector.callStructure; | 2322 CallStructure callStructure = selector.callStructure; |
2323 TypeMask mask = inTreeData.typeOfSend(node); | 2323 TypeMask mask = inTreeData.typeOfSend(node); |
2324 // In erroneous code the number of arguments in the selector might not | 2324 // In erroneous code the number of arguments in the selector might not |
2325 // match the function element. | 2325 // match the function element. |
2326 // TODO(polux): return nonNullEmpty and check it doesn'TypeInformation break
anything | 2326 // TODO(polux): return nonNullEmpty and check it doesn'TypeInformation break
anything |
2327 if (target.isMalformed || !callStructure.signatureApplies(target.type)) { | 2327 if (target.isMalformed || |
| 2328 !callStructure.signatureApplies(target.parameterStructure)) { |
2328 return types.dynamicType; | 2329 return types.dynamicType; |
2329 } | 2330 } |
2330 | 2331 |
2331 TypeInformation returnType = | 2332 TypeInformation returnType = |
2332 handleStaticSend(node, selector, mask, target, arguments); | 2333 handleStaticSend(node, selector, mask, target, arguments); |
2333 if (Elements.isGrowableListConstructorCall( | 2334 if (Elements.isGrowableListConstructorCall( |
2334 constructor, node, closedWorld.commonElements)) { | 2335 constructor, node, closedWorld.commonElements)) { |
2335 return inferrer.concreteTypes.putIfAbsent( | 2336 return inferrer.concreteTypes.putIfAbsent( |
2336 node, | 2337 node, |
2337 () => types.allocateList(types.growableListType, node, | 2338 () => types.allocateList(types.growableListType, node, |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2939 Selector moveNextSelector = Selectors.moveNext; | 2940 Selector moveNextSelector = Selectors.moveNext; |
2940 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); | 2941 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); |
2941 | 2942 |
2942 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, | 2943 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, |
2943 iteratorMask, expressionType, new ArgumentsTypes.empty()); | 2944 iteratorMask, expressionType, new ArgumentsTypes.empty()); |
2944 | 2945 |
2945 return handleForInLoop(node, iteratorType, currentSelector, currentMask, | 2946 return handleForInLoop(node, iteratorType, currentSelector, currentMask, |
2946 moveNextSelector, moveNextMask); | 2947 moveNextSelector, moveNextMask); |
2947 } | 2948 } |
2948 } | 2949 } |
OLD | NEW |