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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 T visitThrow(Throw node) { | 1073 T visitThrow(Throw node) { |
1074 node.visitChildren(this); | 1074 node.visitChildren(this); |
1075 locals.seenReturnOrThrow = true; | 1075 locals.seenReturnOrThrow = true; |
1076 return types.nonNullEmpty(); | 1076 return types.nonNullEmpty(); |
1077 } | 1077 } |
1078 | 1078 |
1079 T visitCatchBlock(CatchBlock node) { | 1079 T visitCatchBlock(CatchBlock node) { |
1080 Node exception = node.exception; | 1080 Node exception = node.exception; |
1081 if (exception != null) { | 1081 if (exception != null) { |
1082 DartType type = elements.getType(node.type); | 1082 DartType type = elements.getType(node.type); |
1083 T mask = type == null || type.treatAsDynamic | 1083 T mask = type == null || |
| 1084 type.treatAsDynamic || |
| 1085 type.kind == TypeKind.TYPE_VARIABLE |
1084 ? types.dynamicType | 1086 ? types.dynamicType |
1085 : types.nonNullSubtype(type.element); | 1087 : types.nonNullSubtype(type.element); |
1086 locals.update(elements[exception], mask, node); | 1088 locals.update(elements[exception], mask, node); |
1087 } | 1089 } |
1088 Node trace = node.trace; | 1090 Node trace = node.trace; |
1089 if (trace != null) { | 1091 if (trace != null) { |
1090 locals.update(elements[trace], types.dynamicType, node); | 1092 locals.update(elements[trace], types.dynamicType, node); |
1091 } | 1093 } |
1092 visit(node.block); | 1094 visit(node.block); |
1093 return null; | 1095 return null; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 return type; | 1215 return type; |
1214 } | 1216 } |
1215 | 1217 |
1216 T visitCascade(Cascade node) { | 1218 T visitCascade(Cascade node) { |
1217 // Ignore the result of the cascade send and return the type of the cascade | 1219 // Ignore the result of the cascade send and return the type of the cascade |
1218 // receiver. | 1220 // receiver. |
1219 visit(node.expression); | 1221 visit(node.expression); |
1220 return cascadeReceiverStack.removeLast(); | 1222 return cascadeReceiverStack.removeLast(); |
1221 } | 1223 } |
1222 } | 1224 } |
OLD | NEW |