IR: cleanup expression implementations

Remove unused constructors with descriptors, minimize usages of
secondary constructors and make some properties non-lateinit, fix some
inspections.
This commit is contained in:
Alexander Udalov
2020-07-22 16:51:13 +02:00
parent e36d3ba4f6
commit 687d13a320
28 changed files with 58 additions and 206 deletions
@@ -220,12 +220,13 @@ class FinallyBlocksLowering(val context: CommonBackendContext, private val throw
endOffset = endOffset,
type = context.irBuiltIns.unitType
).apply {
this.catches += irCatch(catchParameter).apply {
result = irComposite {
this.catches += irCatch(
catchParameter,
irComposite {
+finallyExpression.copy()
+irThrow(irGet(catchParameter))
}
}
)
this.finallyExpression = null
}
@@ -111,11 +111,8 @@ fun IrBuilderWithScope.irNot(arg: IrExpression) =
fun IrBuilderWithScope.irThrow(arg: IrExpression) =
IrThrowImpl(startOffset, endOffset, context.irBuiltIns.nothingType, arg)
fun IrBuilderWithScope.irCatch(catchParameter: IrVariable) =
IrCatchImpl(
startOffset, endOffset,
catchParameter
)
fun IrBuilderWithScope.irCatch(catchParameter: IrVariable, result: IrExpression): IrCatch =
IrCatchImpl(startOffset, endOffset, catchParameter, result)
fun IrBuilderWithScope.irImplicitCoercionToUnit(arg: IrExpression) =
IrTypeOperatorCallImpl(