blob: 36a95abb212acada72fbb3d7dce48e9d05970a72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package com.google.devtools.ksp.symbol.impl.binary
import com.google.devtools.ksp.KSObjectCache
import com.google.devtools.ksp.symbol.*
import com.google.devtools.ksp.symbol.impl.kotlin.KSNameImpl
import com.google.devtools.ksp.toKSModifiers
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
class KSTypeAliasDescriptorImpl(descriptor: TypeAliasDescriptor) :
KSTypeAlias,
KSDeclarationDescriptorImpl(descriptor),
KSExpectActual by KSExpectActualDescriptorImpl(descriptor) {
companion object : KSObjectCache<TypeAliasDescriptor, KSTypeAliasDescriptorImpl>() {
fun getCached(descriptor: TypeAliasDescriptor) = KSTypeAliasDescriptorImpl.cache.getOrPut(descriptor) {
KSTypeAliasDescriptorImpl(descriptor)
}
}
override val name: KSName by lazy {
KSNameImpl.getCached(descriptor.name.asString())
}
override val modifiers: Set<Modifier> by lazy {
descriptor.toKSModifiers()
}
override val typeParameters: List<KSTypeParameter> by lazy {
descriptor.declaredTypeParameters.map { KSTypeParameterDescriptorImpl.getCached(it) }
}
override val type: KSTypeReference by lazy {
KSTypeReferenceDescriptorImpl.getCached(descriptor.underlyingType, origin, this)
}
override fun <D, R> accept(visitor: KSVisitor<D, R>, data: D): R {
return visitor.visitTypeAlias(this, data)
}
}
|