[C-interop] Stubs for C functions without parameter names should have non-stable names
^KT-41250
This commit is contained in:
committed by
Dmitriy Dolovov
parent
ccb6927e05
commit
6c187278ee
+2
-1
@@ -490,7 +490,8 @@ data class FunctionStub(
|
||||
val receiver: ReceiverParameterStub?,
|
||||
val modality: MemberStubModality,
|
||||
val typeParameters: List<TypeParameterStub> = emptyList(),
|
||||
val isOverride: Boolean = false
|
||||
val isOverride: Boolean = false,
|
||||
val hasStableParameterNames: Boolean = true
|
||||
) : StubElementWithOrigin, FunctionalStub {
|
||||
|
||||
override fun <T, R> accept(visitor: StubIrVisitor<T, R>, data: T) =
|
||||
|
||||
+4
-1
@@ -475,9 +475,11 @@ internal class FunctionStubBuilder(
|
||||
val platform = context.platform
|
||||
val parameters = mutableListOf<FunctionParameterStub>()
|
||||
|
||||
var hasStableParameterNames = true
|
||||
func.parameters.forEachIndexed { index, parameter ->
|
||||
val parameterName = parameter.name.let {
|
||||
if (it == null || it.isEmpty()) {
|
||||
hasStableParameterNames = false
|
||||
"arg$index"
|
||||
} else {
|
||||
it
|
||||
@@ -547,7 +549,8 @@ internal class FunctionStubBuilder(
|
||||
annotations,
|
||||
mustBeExternal,
|
||||
null,
|
||||
MemberStubModality.FINAL
|
||||
MemberStubModality.FINAL,
|
||||
hasStableParameterNames = hasStableParameterNames
|
||||
)
|
||||
return listOf(functionStub)
|
||||
}
|
||||
|
||||
+2
-1
@@ -257,7 +257,8 @@ private class MappingExtensions(
|
||||
get() = flagsOfNotNull(
|
||||
Flag.IS_PUBLIC,
|
||||
Flag.Function.IS_EXTERNAL.takeIf { this.external },
|
||||
Flag.HAS_ANNOTATIONS.takeIf { annotations.isNotEmpty() }
|
||||
Flag.HAS_ANNOTATIONS.takeIf { annotations.isNotEmpty() },
|
||||
Flag.Function.HAS_NON_STABLE_PARAMETER_NAMES.takeIf { !this.hasStableParameterNames }
|
||||
) or modality.flags
|
||||
|
||||
val Classifier.fqNameSerialized: String
|
||||
|
||||
Reference in New Issue
Block a user