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 ClosureRepresentationInfo; | 7 import '../closure.dart' show ClosureRepresentationInfo; |
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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 TypeInformation visitThrow(ast.Throw node) { | 737 TypeInformation visitThrow(ast.Throw node) { |
738 node.visitChildren(this); | 738 node.visitChildren(this); |
739 locals.seenReturnOrThrow = true; | 739 locals.seenReturnOrThrow = true; |
740 return types.nonNullEmpty(); | 740 return types.nonNullEmpty(); |
741 } | 741 } |
742 | 742 |
743 TypeInformation visitCatchBlock(ast.CatchBlock node) { | 743 TypeInformation visitCatchBlock(ast.CatchBlock node) { |
744 ast.Node exception = node.exception; | 744 ast.Node exception = node.exception; |
745 if (exception != null) { | 745 if (exception != null) { |
746 ResolutionDartType type = elements.getType(node.type); | 746 ResolutionDartType type = elements.getType(node.type); |
747 TypeInformation mask = | 747 TypeInformation mask; |
748 type == null || type.treatAsDynamic || type.isTypeVariable | 748 if (type == null || type.treatAsDynamic || type.isTypeVariable) { |
749 ? types.dynamicType | 749 mask = types.dynamicType; |
750 : types.nonNullSubtype(type.element); | 750 } else { |
| 751 ResolutionInterfaceType interfaceType = type; |
| 752 mask = types.nonNullSubtype(interfaceType.element); |
| 753 } |
751 locals.update(elements[exception], mask, node); | 754 locals.update(elements[exception], mask, node); |
752 } | 755 } |
753 ast.Node trace = node.trace; | 756 ast.Node trace = node.trace; |
754 if (trace != null) { | 757 if (trace != null) { |
755 locals.update(elements[trace], types.dynamicType, node); | 758 locals.update(elements[trace], types.dynamicType, node); |
756 } | 759 } |
757 visit(node.block); | 760 visit(node.block); |
758 return null; | 761 return null; |
759 } | 762 } |
760 | 763 |
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2942 Selector moveNextSelector = Selectors.moveNext; | 2945 Selector moveNextSelector = Selectors.moveNext; |
2943 TypeMask moveNextMask = memberData.typeOfIteratorMoveNext(node); | 2946 TypeMask moveNextMask = memberData.typeOfIteratorMoveNext(node); |
2944 | 2947 |
2945 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, | 2948 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, |
2946 iteratorMask, expressionType, new ArgumentsTypes.empty()); | 2949 iteratorMask, expressionType, new ArgumentsTypes.empty()); |
2947 | 2950 |
2948 return handleForInLoop(node, iteratorType, currentSelector, currentMask, | 2951 return handleForInLoop(node, iteratorType, currentSelector, currentMask, |
2949 moveNextSelector, moveNextMask); | 2952 moveNextSelector, moveNextMask); |
2950 } | 2953 } |
2951 } | 2954 } |
OLD | NEW |