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