[IR] Rewrite generator for interpreter map
1. Reuse `DisabledIdSignatureDescriptor` to create `IrBuiltIns` 2. Provide FQ names for types to ensure method find correctness
This commit is contained in:
+3
-3
@@ -155,7 +155,7 @@ internal class DefaultCallInterceptor(override val interpreter: IrInterpreter) :
|
||||
}
|
||||
|
||||
val receiverType = irFunction.dispatchReceiverParameter?.type ?: irFunction.extensionReceiverParameter?.type
|
||||
val argsType = (listOfNotNull(receiverType) + irFunction.valueParameters.map { it.type }).map { it.getOnlyName() }
|
||||
val argsType = (listOfNotNull(receiverType) + irFunction.valueParameters.map { it.type }).map { it.fqNameWithNullability() }
|
||||
val argsValues = args.wrap(this, irFunction)
|
||||
|
||||
withExceptionHandler(environment) {
|
||||
@@ -170,8 +170,8 @@ internal class DefaultCallInterceptor(override val interpreter: IrInterpreter) :
|
||||
if (environment.configuration.platform.isJs()) {
|
||||
if (signature.name == "toString") return signature.args[0].value.specialToStringForJs()
|
||||
if (signature.name == "toFloat") signature.name = "toDouble"
|
||||
signature.args.filter { it.type == "Float" }.forEach {
|
||||
it.type = "Double"
|
||||
signature.args.filter { it.type == "kotlin.Float" }.forEach {
|
||||
it.type = "kotlin.Double"
|
||||
it.value = it.value.toString().toDouble()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,14 @@ internal fun IrFunction.getArgsForMethodInvocation(
|
||||
return argsValues
|
||||
}
|
||||
|
||||
internal fun IrType.fqNameWithNullability(): String {
|
||||
val fqName = classFqName?.toString()
|
||||
?: (this.classifierOrNull?.owner as? IrDeclarationWithName)?.name?.asString()
|
||||
?: render()
|
||||
val nullability = if (this is IrSimpleType && this.nullability == SimpleTypeNullability.MARKED_NULLABLE) "?" else ""
|
||||
return fqName + nullability
|
||||
}
|
||||
|
||||
internal fun IrType.getOnlyName(): String {
|
||||
if (this !is IrSimpleType) return this.render()
|
||||
return (this.classifierOrFail.owner as IrDeclarationWithName).name.asString() + when (nullability) {
|
||||
|
||||
+539
-563
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user