Collect classes for JVM that must be regenerated after IR inline
This commit is contained in:
+2
@@ -198,6 +198,7 @@ fun IrClass.addFunction(
|
||||
isStatic: Boolean = false,
|
||||
isSuspend: Boolean = false,
|
||||
isFakeOverride: Boolean = false,
|
||||
isInline: Boolean = false,
|
||||
origin: IrDeclarationOrigin = IrDeclarationOrigin.DEFINED,
|
||||
startOffset: Int = UNDEFINED_OFFSET,
|
||||
endOffset: Int = UNDEFINED_OFFSET
|
||||
@@ -211,6 +212,7 @@ fun IrClass.addFunction(
|
||||
this.visibility = visibility
|
||||
this.isSuspend = isSuspend
|
||||
this.isFakeOverride = isFakeOverride
|
||||
this.isInline = isInline
|
||||
this.origin = origin
|
||||
}.apply {
|
||||
if (!isStatic) {
|
||||
|
||||
@@ -92,11 +92,10 @@ fun IrFunctionAccessExpression.getArgumentsWithSymbols(): List<Pair<IrValueParam
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds the arguments explicitly represented in the IR to the parameters of the accessed function.
|
||||
* Binds all arguments represented in the IR to the parameters of the accessed function.
|
||||
* The arguments are to be evaluated in the same order as they appear in the resulting list.
|
||||
*/
|
||||
fun IrMemberAccessExpression<*>.getArgumentsWithIr(): List<Pair<IrValueParameter, IrExpression>> {
|
||||
val res = mutableListOf<Pair<IrValueParameter, IrExpression>>()
|
||||
fun IrMemberAccessExpression<*>.getAllArgumentsWithIr(): List<Pair<IrValueParameter, IrExpression?>> {
|
||||
val irFunction = when (this) {
|
||||
is IrFunctionAccessExpression -> this.symbol.owner
|
||||
is IrFunctionReference -> this.symbol.owner
|
||||
@@ -107,6 +106,16 @@ fun IrMemberAccessExpression<*>.getArgumentsWithIr(): List<Pair<IrValueParameter
|
||||
else -> error(this)
|
||||
}
|
||||
|
||||
return getAllArgumentsWithIr(irFunction)
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds all arguments represented in the IR to the parameters of the explicitly given function.
|
||||
* The arguments are to be evaluated in the same order as they appear in the resulting list.
|
||||
*/
|
||||
fun IrMemberAccessExpression<*>.getAllArgumentsWithIr(irFunction: IrFunction): List<Pair<IrValueParameter, IrExpression?>> {
|
||||
val res = mutableListOf<Pair<IrValueParameter, IrExpression?>>()
|
||||
|
||||
dispatchReceiver?.let { arg ->
|
||||
irFunction.dispatchReceiverParameter?.let { parameter -> res += (parameter to arg) }
|
||||
}
|
||||
@@ -116,15 +125,21 @@ fun IrMemberAccessExpression<*>.getArgumentsWithIr(): List<Pair<IrValueParameter
|
||||
}
|
||||
|
||||
irFunction.valueParameters.forEachIndexed { index, it ->
|
||||
val arg = getValueArgument(index)
|
||||
if (arg != null) {
|
||||
res += (it to arg)
|
||||
}
|
||||
res += it to getValueArgument(index)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds the arguments explicitly represented in the IR to the parameters of the accessed function.
|
||||
* The arguments are to be evaluated in the same order as they appear in the resulting list.
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun IrMemberAccessExpression<*>.getArgumentsWithIr(): List<Pair<IrValueParameter, IrExpression>> {
|
||||
return getAllArgumentsWithIr().filter { it.second != null } as List<Pair<IrValueParameter, IrExpression>>
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets arguments that are specified by given mapping of parameters.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user