PSI2IR / FIR2IR: do not create temporaries for adapted references

Arguments to function references behave the same as arguments to
function calls and should be evaluated once regardless, so the temporary
is unnecessary.
This commit is contained in:
pyos
2020-10-06 16:14:13 +02:00
committed by max-kammerer
parent 369056ca5d
commit ccf921510d
8 changed files with 16 additions and 52 deletions
@@ -529,12 +529,6 @@ val IrDeclaration.isFileClass: Boolean
val IrValueDeclaration.isImmutable: Boolean
get() = this is IrValueParameter || this is IrVariable && !isVar
fun IrExpression.isSafeToUseWithoutCopying() =
this is IrGetObjectValue ||
this is IrGetEnumValue ||
this is IrConst<*> ||
this is IrGetValue && symbol.isBound && symbol.owner.isImmutable
val IrStatementOrigin?.isLambda: Boolean
get() = this == IrStatementOrigin.LAMBDA || this == IrStatementOrigin.ANONYMOUS_FUNCTION