[Native] Drop addArguments from IrUtils2
We can simplify single usage of this function
This commit is contained in:
+1
-2
@@ -38,11 +38,10 @@ private fun Context.getTypeConversionImpl(
|
|||||||
if (actualInlinedClass == expectedInlinedClass) return null
|
if (actualInlinedClass == expectedInlinedClass) return null
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
actualInlinedClass == null && expectedInlinedClass == null -> null
|
|
||||||
actualInlinedClass != null && expectedInlinedClass == null -> getBoxFunction(actualInlinedClass)
|
actualInlinedClass != null && expectedInlinedClass == null -> getBoxFunction(actualInlinedClass)
|
||||||
actualInlinedClass == null && expectedInlinedClass != null -> getUnboxFunction(expectedInlinedClass)
|
actualInlinedClass == null && expectedInlinedClass != null -> getUnboxFunction(expectedInlinedClass)
|
||||||
else -> error("actual type is ${actualInlinedClass?.fqNameForIrSerialization}, expected ${expectedInlinedClass?.fqNameForIrSerialization}")
|
else -> error("actual type is ${actualInlinedClass?.fqNameForIrSerialization}, expected ${expectedInlinedClass?.fqNameForIrSerialization}")
|
||||||
}?.symbol
|
}.symbol
|
||||||
}
|
}
|
||||||
|
|
||||||
internal object DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION : IrDeclarationOriginImpl("INLINE_CLASS_SPECIAL_FUNCTION")
|
internal object DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION : IrDeclarationOriginImpl("INLINE_CLASS_SPECIAL_FUNCTION")
|
||||||
|
|||||||
+2
-2
@@ -146,12 +146,12 @@ private class AutoboxingTransformer(val context: Context) : AbstractValueUsageTr
|
|||||||
it.type = expectedType
|
it.type = expectedType
|
||||||
return it
|
return it
|
||||||
}
|
}
|
||||||
val parameter = conversion.owner.explicitParameters.single()
|
val parameter = conversion.owner.valueParameters.single()
|
||||||
val argument = this.uncheckedCast(parameter.type)
|
val argument = this.uncheckedCast(parameter.type)
|
||||||
|
|
||||||
IrCallImpl(startOffset, endOffset, conversion.owner.returnType, conversion,
|
IrCallImpl(startOffset, endOffset, conversion.owner.returnType, conversion,
|
||||||
conversion.owner.typeParameters.size, conversion.owner.valueParameters.size).apply {
|
conversion.owner.typeParameters.size, conversion.owner.valueParameters.size).apply {
|
||||||
addArguments(mapOf(parameter to argument))
|
this.putValueArgument(parameter.index, argument)
|
||||||
}.uncheckedCast(this.type) // Try not to bring new type incompatibilities.
|
}.uncheckedCast(this.type) // Try not to bring new type incompatibilities.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-26
@@ -68,32 +68,6 @@ fun IrModuleFragment.addFile(fileEntry: IrFileEntry, packageFqName: FqName): IrF
|
|||||||
.also { this.files += it }
|
.also { this.files += it }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrFunctionAccessExpression.addArguments(args: Map<IrValueParameter, IrExpression>) {
|
|
||||||
val unhandledParameters = args.keys.toMutableSet()
|
|
||||||
fun getArg(parameter: IrValueParameter) = args[parameter]?.also { unhandledParameters -= parameter }
|
|
||||||
|
|
||||||
symbol.owner.dispatchReceiverParameter?.let {
|
|
||||||
val arg = getArg(it)
|
|
||||||
if (arg != null) {
|
|
||||||
this.dispatchReceiver = arg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
symbol.owner.extensionReceiverParameter?.let {
|
|
||||||
val arg = getArg(it)
|
|
||||||
if (arg != null) {
|
|
||||||
this.extensionReceiver = arg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
symbol.owner.valueParameters.forEach {
|
|
||||||
val arg = getArg(it)
|
|
||||||
if (arg != null) {
|
|
||||||
this.putValueArgument(it.index, arg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun IrBuilderWithScope.irCatch() =
|
fun IrBuilderWithScope.irCatch() =
|
||||||
IrCatchImpl(
|
IrCatchImpl(
|
||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
|
|||||||
Reference in New Issue
Block a user