Created
June 17, 2024 08:04
-
-
Save sasssass/9a079b9deca16b4c69c5fe56779a68c7 to your computer and use it in GitHub Desktop.
NodeProcessor.kt
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
class NodeProcessor( | |
private val logger: KSPLogger, | |
private val codeGenerator: CodeGenerator | |
): SymbolProcessor { | |
override fun process(resolver: Resolver): List<KSAnnotated> { | |
logger.info("NodeProcessor was invoked.") | |
val symbols = resolver.getSymbolsWithAnnotation(NavigationNode::class.qualifiedName!!) | |
val ret = mutableListOf<KSAnnotated>() | |
symbols.forEach { symbol -> | |
if (symbol is KSFunctionDeclaration && symbol.validate()) { | |
val annotation = symbol.annotations.first { it.shortName.asString() == "NavigationNode" } | |
val route = annotation.arguments.first { it.name?.asString() == "route" }.value as String | |
val args = annotation.arguments.first { it.name?.asString() == "args" }.value as ArrayList<String> | |
val optionalArgs = annotation.arguments.first { it.name?.asString() == "optionalArgs" }.value as ArrayList<String> | |
// add code for generating | |
} else { | |
ret.add(symbol) | |
} | |
} | |
return ret | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment