Last active
June 12, 2021 20:43
-
-
Save drawers/3052e618b688469e1d093df9cf6f89a7 to your computer and use it in GitHub Desktop.
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