[JS IR BE] Use return type in function signature for inline classes
Bridge function should be created when return type of override function
is specialised to unboxed inline class. Thus return type should be used in
function signature.
Non-inline-class return types are not added to signature for interop and
infrastructure reasons ("toString" would become "toString_ret$kotlin_String")
This commit is contained in:
+5
-2
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrNull
|
||||
import org.jetbrains.kotlin.ir.types.isUnit
|
||||
import org.jetbrains.kotlin.ir.util.isInlined
|
||||
import org.jetbrains.kotlin.ir.util.isInterface
|
||||
import org.jetbrains.kotlin.ir.util.isReal
|
||||
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||
@@ -188,13 +189,15 @@ class FunctionAndSignature(val function: IrSimpleFunction) {
|
||||
private data class Signature(
|
||||
val name: Name,
|
||||
val extensionReceiverType: String?,
|
||||
val valueParameters: List<String?>
|
||||
val valueParameters: List<String?>,
|
||||
val returnType: String?
|
||||
)
|
||||
|
||||
private val signature = Signature(
|
||||
function.name,
|
||||
function.extensionReceiverParameter?.type?.asString(),
|
||||
function.valueParameters.map { it.type.asString() }
|
||||
function.valueParameters.map { it.type.asString() },
|
||||
function.returnType.run { if (isInlined()) asString() else null }
|
||||
)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
||||
+7
@@ -13,8 +13,10 @@ import org.jetbrains.kotlin.ir.expressions.IrLoop
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
||||
import org.jetbrains.kotlin.ir.types.isUnit
|
||||
import org.jetbrains.kotlin.ir.util.isDynamic
|
||||
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
|
||||
import org.jetbrains.kotlin.ir.util.isInlined
|
||||
import org.jetbrains.kotlin.js.backend.ast.JsName
|
||||
import org.jetbrains.kotlin.js.naming.isES5IdentifierPart
|
||||
import org.jetbrains.kotlin.js.naming.isES5IdentifierStart
|
||||
@@ -201,6 +203,11 @@ class SimpleNameGenerator : NameGenerator {
|
||||
declaration.valueParameters.ifNotEmpty {
|
||||
joinTo(nameBuilder, "") { "_${it.type.asString()}" }
|
||||
}
|
||||
declaration.returnType.let {
|
||||
if (it.isInlined()) {
|
||||
nameBuilder.append("_ret$${it.asString()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user