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

se.ansman.dagger.auto.compiler.common.ksp.processing.KspProperty.kt Maven / Gradle / Ivy

package se.ansman.dagger.auto.compiler.common.ksp.processing

import com.google.devtools.ksp.symbol.KSDeclaration
import com.google.devtools.ksp.symbol.KSPropertyDeclaration
import com.squareup.kotlinpoet.AnnotationSpec
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.TypeName
import se.ansman.dagger.auto.compiler.common.processing.Property

data class KspProperty(
    override val node: KSPropertyDeclaration,
    override val resolver: KspResolver,
) : KspExecutableNode(), Property {
    override val annotations: List by lazy(LazyThreadSafetyMode.NONE) {
        (node.annotations + (node.getter?.annotations ?: emptySequence()))
            .map { KspAnnotationModel(it, resolver) }
            .toList()
    }

    override val receiver: KspType? by lazy(LazyThreadSafetyMode.NONE) {
        node.extensionReceiver?.resolve()?.let { KspType(it, resolver) }
    }

    override val returnType: KspType by lazy(LazyThreadSafetyMode.NONE) {
        node.type.resolve().let { KspType(it, resolver) }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy