Don't wrap return and error expressions into returns
This commit is contained in:
committed by
Dmitry Petrov
parent
72eb317164
commit
6bd27e52bc
@@ -105,7 +105,12 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun IrExpression.wrapWithReturn() = generateReturnExpression(startOffset, endOffset, this)
|
private fun IrExpression.wrapWithReturn() =
|
||||||
|
if (this is IrReturn || this is IrErrorExpression || this is IrThrow)
|
||||||
|
this
|
||||||
|
else {
|
||||||
|
generateReturnExpression(startOffset, endOffset, this) }
|
||||||
|
|
||||||
|
|
||||||
private fun generateReturnExpression(startOffset: Int, endOffset: Int, returnValue: IrExpression): IrReturnImpl {
|
private fun generateReturnExpression(startOffset: Int, endOffset: Int, returnValue: IrExpression): IrReturnImpl {
|
||||||
val returnTarget = (scopeOwner as? CallableDescriptor) ?:
|
val returnTarget = (scopeOwner as? CallableDescriptor) ?:
|
||||||
|
|||||||
Reference in New Issue
Block a user