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

main.seskar.compiler.props.backend.PropsDeclarationChecker.kt Maven / Gradle / Ivy

There is a newer version: 3.75.0
Show newest version
package seskar.compiler.props.backend

import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker
import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
import seskar.compiler.props.diagnostic.PropsErrors

internal object PropsDeclarationChecker : DeclarationChecker {
    override fun check(
        declaration: KtDeclaration,
        descriptor: DeclarationDescriptor,
        context: DeclarationCheckerContext,
    ) {
        if (declaration !is KtClassOrObject) return
        if (descriptor !is ClassDescriptor) return
        if (descriptor.kind != ClassKind.INTERFACE) return
        if (descriptor.isEffectivelyExternal()) return
        if (!descriptor.implementsProps) return

        context.trace.report(PropsErrors.NON_EXTERNAL_PROPS.on(declaration))
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy