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