This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inner class Visitor : KSVisitorVoid() { | |
override fun visitClassDeclaration(classDeclaration: KSClassDeclaration, data: Unit) { | |
val qualifiedName = classDeclaration.qualifiedName?.asString() | |
if (!classDeclaration.isDataClass()) { | |
logger.error( | |
"@IntSummable cannot target non-data class $qualifiedName", | |
classDeclaration | |
) | |
return | |
} | |
if (qualifiedName == null) { | |
logger.error( | |
"@IntSummable must target classes with qualified names", | |
classDeclaration | |
) | |
return | |
} | |
} | |
private fun KSClassDeclaration.isDataClass() = modifiers.contains(Modifier.DATA) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment