From eba08c567413c6316f8cd45ab30fb78b519bc51b Mon Sep 17 00:00:00 2001 From: Konstantin Anisimov Date: Wed, 11 Jan 2017 16:21:42 +0700 Subject: [PATCH] New "return" remove scheme --- .../kotlin/backend/konan/lower/FunctionInlining.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt index 5c41d1a313e..5e14d853522 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt @@ -37,10 +37,10 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoid( val copyFuncDeclaration = functionDeclaration.accept(DeepCopyIrTree(), null) as IrFunction // Create copy of the function. val body = copyFuncDeclaration.body!! as IrBlockBody - val statements = removeReturn(body.statements) // Replace "return" with its value. val startOffset = copyFuncDeclaration.startOffset val endOffset = copyFuncDeclaration.endOffset val returnType = copyFuncDeclaration.descriptor.returnType!! + val statements = body.statements val irBlock = IrBlockImpl(startOffset, endOffset, returnType, null, statements) // Create IrBlock containing function statements. val parameterToExpression = expression.getArguments() // Build map parameter -> expression. @@ -63,6 +63,14 @@ internal class ParametersTransformer(val parameterToExpression: List