| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../compiler.dart'; | 9 import '../compiler.dart'; |
| 10 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 elementType = elementType == null | 175 elementType = elementType == null |
| 176 ? types.allocatePhi(null, null, type, isTry: false) | 176 ? types.allocatePhi(null, null, type, isTry: false) |
| 177 : types.addPhiInput(null, elementType, type); | 177 : types.addPhiInput(null, elementType, type); |
| 178 length++; | 178 length++; |
| 179 } | 179 } |
| 180 elementType = elementType == null | 180 elementType = elementType == null |
| 181 ? types.nonNullEmpty() | 181 ? types.nonNullEmpty() |
| 182 : types.simplifyPhi(null, null, elementType); | 182 : types.simplifyPhi(null, null, elementType); |
| 183 TypeInformation containerType = | 183 TypeInformation containerType = |
| 184 listLiteral.isConst ? types.constListType : types.growableListType; | 184 listLiteral.isConst ? types.constListType : types.growableListType; |
| 185 // TODO(efortuna): Change signature of allocateList and the rest of | |
| 186 // type_system to deal with Kernel elements. | |
| 187 return types.allocateList( | 185 return types.allocateList( |
| 188 containerType, listLiteral, analyzedMember, elementType, length); | 186 containerType, listLiteral, analyzedMember, elementType, length); |
| 189 }); | 187 }); |
| 190 } | 188 } |
| 191 | 189 |
| 192 @override | 190 @override |
| 193 TypeInformation visitReturnStatement(ir.ReturnStatement node) { | 191 TypeInformation visitReturnStatement(ir.ReturnStatement node) { |
| 194 ir.Node expression = node.expression; | 192 ir.Node expression = node.expression; |
| 195 recordReturnType( | 193 recordReturnType( |
| 196 expression == null ? types.nullType : expression.accept(this)); | 194 expression == null ? types.nullType : expression.accept(this)); |
| 197 locals.seenReturnOrThrow = true; | 195 locals.seenReturnOrThrow = true; |
| 198 initializationIsIndefinite(); | 196 initializationIsIndefinite(); |
| 199 return null; | 197 return null; |
| 200 } | 198 } |
| 201 } | 199 } |
| OLD | NEW |