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

com.google.devtools.ksp.impl.symbol.kotlin.KSDefNonNullReferenceImpl.kt Maven / Gradle / Ivy

There is a newer version: 2.1.0-RC2-1.0.28
Show newest version
package com.google.devtools.ksp.impl.symbol.kotlin

import com.google.devtools.ksp.common.IdKeyPair
import com.google.devtools.ksp.common.KSObjectCache
import com.google.devtools.ksp.symbol.*
import org.jetbrains.kotlin.analysis.api.types.KaDefinitelyNotNullType

class KSDefNonNullReferenceImpl private constructor(
    private val ktDefinitelyNotNullType: KaDefinitelyNotNullType,
    override val parent: KSTypeReference?
) : KSDefNonNullReference {
    companion object : KSObjectCache, KSDefNonNullReference>() {
        fun getCached(ktType: KaDefinitelyNotNullType, parent: KSTypeReference?) =
            KSDefNonNullReferenceImpl.cache
                .getOrPut(IdKeyPair(ktType, parent)) { KSDefNonNullReferenceImpl(ktType, parent) }
    }
    override val enclosedType: KSClassifierReference by lazy {
        ktDefinitelyNotNullType.original.toClassifierReference(parent) as KSClassifierReference
    }
    override val typeArguments: List
        get() = emptyList()

    override val origin: Origin = Origin.KOTLIN

    override val location: Location
        get() = parent?.location ?: NonExistLocation

    override fun toString() = "${enclosedType.referencedName()} & Any"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy