File tree 2 files changed +33
-9
lines changed
kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl
2 files changed +33
-9
lines changed Original file line number Diff line number Diff line change @@ -505,15 +505,23 @@ class ResolverAAImpl(
505
505
if (accessor.receiver.closestClassDeclaration()?.classKind == ClassKind .ANNOTATION_CLASS ) {
506
506
return accessor.receiver.simpleName.asString()
507
507
}
508
+
509
+ val symbol: KaPropertyAccessorSymbol ? = when (accessor) {
510
+ is KSPropertyAccessorImpl -> accessor.ktPropertyAccessorSymbol
511
+ else -> null
512
+ }
513
+
514
+ symbol?.explictJvmName()?.let {
515
+ return it
516
+ }
517
+
508
518
val prefix = if (accessor is KSPropertyGetter ) {
509
519
" get"
510
520
} else {
511
521
" set"
512
522
}
513
- val inlineSuffix = when (accessor) {
514
- is KSPropertyAccessorImpl -> accessor.ktPropertyAccessorSymbol.inlineSuffix
515
- else -> " "
516
- }
523
+
524
+ val inlineSuffix = symbol?.inlineSuffix ? : " "
517
525
val mangledName = if (accessor.modifiers.contains(Modifier .INTERNAL )) {
518
526
" \$ ${ktModule.name} "
519
527
} else " "
@@ -529,10 +537,17 @@ class ResolverAAImpl(
529
537
}?.let {
530
538
return it.name
531
539
}
532
- val inlineSuffix = when (declaration) {
533
- is KSFunctionDeclarationImpl -> declaration.ktFunctionSymbol.inlineSuffix
534
- else -> " "
540
+
541
+ val symbol: KaFunctionSymbol ? = when (declaration) {
542
+ is KSFunctionDeclarationImpl -> declaration.ktFunctionSymbol
543
+ else -> null
544
+ }
545
+
546
+ symbol?.explictJvmName()?.let {
547
+ return it
535
548
}
549
+
550
+ val inlineSuffix = symbol?.inlineSuffix ? : " "
536
551
val mangledName = if (declaration.modifiers.contains(Modifier .INTERNAL )) {
537
552
" \$ ${ktModule.name} "
538
553
} else " "
Original file line number Diff line number Diff line change @@ -965,7 +965,7 @@ internal val KaFunctionSymbol.inlineSuffix: String
965
965
valueParameters.map { it.returnType },
966
966
returnType,
967
967
analyze {
968
- returnType.requiresMangling() && isKotlin && this @inlineSuffix.containingSymbol is KaClassSymbol
968
+ returnType.requiresMangling() && isKotlin && containingDeclaration != null
969
969
}
970
970
)
971
971
@@ -975,7 +975,16 @@ internal val KaPropertyAccessorSymbol.inlineSuffix: String
975
975
mangleInlineSuffix(
976
976
emptyList(),
977
977
returnType,
978
- returnType.requiresMangling() && isKotlin
978
+ analyze {
979
+ returnType.requiresMangling() && isKotlin && containingDeclaration?.containingDeclaration != null
980
+ }
979
981
)
980
982
is KaPropertySetterSymbol -> mangleInlineSuffix(listOf (parameter.returnType), null , false )
981
983
}
984
+
985
+ private val jvmNameClassId = ClassId .fromString(" kotlin/jvm/JvmName" )
986
+ internal fun KaCallableSymbol.explictJvmName (): String? {
987
+ return annotations.singleOrNull() {
988
+ it.classId == jvmNameClassId
989
+ }?.arguments?.single()?.expression?.toValue() as ? String
990
+ }
You can’t perform that action at this time.
0 commit comments