Wrap Nothing type into return expression

This commit is contained in:
Michael Bogdanov
2016-10-05 12:35:03 +03:00
committed by Dmitry Petrov
parent 5121fcb287
commit d6b5e48b2a
@@ -105,12 +105,7 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context:
}
}
private fun IrExpression.wrapWithReturn() =
if (KotlinBuiltIns.isNothing(type))
this
else {
generateReturnExpression(startOffset, endOffset, this)
}
private fun IrExpression.wrapWithReturn() = generateReturnExpression(startOffset, endOffset, this)
private fun generateReturnExpression(startOffset: Int, endOffset: Int, returnValue: IrExpression): IrReturnImpl {
val returnTarget = (scopeOwner as? CallableDescriptor) ?: