IR: cleanup expression implementations

Remove unused constructors with descriptors, minimize usages of
secondary constructors and make some properties non-lateinit, fix some
inspections.

(cherry picked from commit 98ad94e630f86bd2c92fc8e2cf0f8796de6002cc)
This commit is contained in:
Alexander Udalov
2020-07-22 16:52:51 +02:00
committed by Vasily Levchenko
parent b2fbe0135f
commit bf74bd76a7
2 changed files with 6 additions and 7 deletions
@@ -1098,7 +1098,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
} }
} }
if (catch.parameter.type == context.builtIns.throwable.defaultType) { if (catch.catchParameter.descriptor.type == context.builtIns.throwable.defaultType) {
genCatchBlock() genCatchBlock()
return // Remaining catch clauses are unreachable. return // Remaining catch clauses are unreachable.
} else { } else {
@@ -267,12 +267,11 @@ internal class FinallyBlocksLowering(val context: Context): FileLoweringPass, Ir
type = context.irBuiltIns.nothingType, type = context.irBuiltIns.nothingType,
tryResult = transformedTry, tryResult = transformedTry,
catches = listOf( catches = listOf(
irCatch(catchParameter).apply { irCatch(catchParameter, irBlock {
result = irBlock { +copy(finallyExpression)
+copy(finallyExpression) +irThrow(irGet(catchParameter))
+irThrow(irGet(catchParameter)) })
} ),
}),
finallyExpression = null finallyExpression = null
) )
using(TryScope(syntheticTry, transformedFinallyExpression, this)) { using(TryScope(syntheticTry, transformedFinallyExpression, this)) {