| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 '../common/codegen.dart' show CodegenRegistry; | 9 import '../common/codegen.dart' show CodegenRegistry; |
| 10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 | 824 |
| 825 @override | 825 @override |
| 826 void visitReturnStatement(ir.ReturnStatement returnStatement) { | 826 void visitReturnStatement(ir.ReturnStatement returnStatement) { |
| 827 HInstruction value; | 827 HInstruction value; |
| 828 if (returnStatement.expression == null) { | 828 if (returnStatement.expression == null) { |
| 829 value = graph.addConstantNull(closedWorld); | 829 value = graph.addConstantNull(closedWorld); |
| 830 } else { | 830 } else { |
| 831 assert(_targetFunction != null && _targetFunction is ir.FunctionNode); | 831 assert(_targetFunction != null && _targetFunction is ir.FunctionNode); |
| 832 returnStatement.expression.accept(this); | 832 returnStatement.expression.accept(this); |
| 833 value = pop(); | 833 value = pop(); |
| 834 DartType returnType = astAdapter.getFunctionReturnType(_targetFunction); | 834 DartType returnType = _elementMap.getFunctionType(_targetFunction); |
| 835 if (_targetFunction.asyncMarker == ir.AsyncMarker.Async) { | 835 if (_targetFunction.asyncMarker == ir.AsyncMarker.Async) { |
| 836 if (options.enableTypeAssertions && | 836 if (options.enableTypeAssertions && |
| 837 !isValidAsyncReturnType(returnType)) { | 837 !isValidAsyncReturnType(returnType)) { |
| 838 generateTypeError( | 838 generateTypeError( |
| 839 returnStatement, | 839 returnStatement, |
| 840 "Async function returned a Future," | 840 "Async function returned a Future," |
| 841 " was declared to return a ${returnType}."); | 841 " was declared to return a ${returnType}."); |
| 842 pop(); | 842 pop(); |
| 843 return; | 843 return; |
| 844 } | 844 } |
| (...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3425 enterBlock.setBlockFlow( | 3425 enterBlock.setBlockFlow( |
| 3426 new HTryBlockInformation( | 3426 new HTryBlockInformation( |
| 3427 kernelBuilder.wrapStatementGraph(bodyGraph), | 3427 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 3428 exception, | 3428 exception, |
| 3429 kernelBuilder.wrapStatementGraph(catchGraph), | 3429 kernelBuilder.wrapStatementGraph(catchGraph), |
| 3430 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3430 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 3431 exitBlock); | 3431 exitBlock); |
| 3432 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3432 kernelBuilder.inTryStatement = previouslyInTryStatement; |
| 3433 } | 3433 } |
| 3434 } | 3434 } |
| OLD | NEW |