All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.io.github.tabilzad.ktor.DeclarationExtension.kt Maven / Gradle / Ivy

There is a newer version: 0.6.5-alpha
Show newest version
package io.github.tabilzad.ktor

import org.jetbrains.kotlin.container.StorageComponentContainer
import org.jetbrains.kotlin.container.useInstance
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker
import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext

// Registers K1 component
class DeclarationExtension(
    private val configuration: PluginConfiguration
) : StorageComponentContainerContributor {


    override fun registerModuleComponents(
        container: StorageComponentContainer,
        platform: TargetPlatform,
        moduleDescriptor: ModuleDescriptor
    ) {

        container.useInstance(object : DeclarationChecker {
            override fun check(
                declaration: KtDeclaration,
                descriptor: DeclarationDescriptor,
                context: DeclarationCheckerContext
            ) {
                swaggerExtensionPhase(configuration, declaration, descriptor, context)
            }
        })
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy