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
@@ -847,9 +847,7 @@ class Fir2IrVisitor(
override fun visitCatch(catch: FirCatch, data: Any?): IrElement {
return catch.convertWithOffsets { startOffset, endOffset ->
val catchParameter = declarationStorage.createIrVariable(catch.parameter, conversionScope.parentFromStack())
IrCatchImpl(startOffset, endOffset, catchParameter).apply {
result = catch.block.convertToIrExpressionOrBlock()
}
IrCatchImpl(startOffset, endOffset, catchParameter, catch.block.convertToIrExpressionOrBlock())
}
}
@@ -273,9 +273,9 @@ class CallAndReferenceGenerator(
val fir = calleeReference.resolvedSymbol.fir
if (this is FirFunctionCall && fir is FirSimpleFunction && fir.origin == FirDeclarationOrigin.SamConstructor) {
return convertWithOffsets { startOffset, endOffset ->
IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.SAM_CONVERSION, type).apply {
argument = visitor.convertToIrExpression(this@tryConvertToSamConstructorCall.argument)
}
IrTypeOperatorCallImpl(
startOffset, endOffset, type, IrTypeOperator.SAM_CONVERSION, type, visitor.convertToIrExpression(argument)
)
}
}
return null