Skip to content

Commit

Permalink
Check for properties starting with 'is'
Browse files Browse the repository at this point in the history
(cherry picked from commit 37f3dc7)
  • Loading branch information
jonamireh authored and KSP Auto Pick committed Nov 1, 2024
1 parent bdf83f1 commit 1a84927
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,16 +458,18 @@ class ResolverAAImpl(
return accessor.receiver.simpleName.asString()
}

val prefix = if (accessor is KSPropertyGetter) {
"get"
} else {
"set"
val name = accessor.receiver.simpleName.asString()
val uppercasedName = name.replaceFirstChar(Char::uppercaseChar)
// https://kotlinlang.org/docs/java-to-kotlin-interop.html#properties
val prefixedName = when(accessor) {
is KSPropertyGetter -> if(name.startsWith("is")) name else "get$uppercasedName"
is KSPropertySetter -> if(name.startsWith("is")) "set${name.removePrefix("is")}" else "set$uppercasedName"
else -> ""
}

val name = accessor.receiver.simpleName.asString().replaceFirstChar(Char::uppercaseChar)
val inlineSuffix = symbol?.inlineSuffix ?: ""
val mangledName = symbol?.internalSuffix ?: ""
return "$prefix$name$inlineSuffix$mangledName"
return "$prefixedName$inlineSuffix$mangledName"
}

// TODO: handle library symbols
Expand Down

0 comments on commit 1a84927

Please sign in to comment.