-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add createKSTypeReferenceFromKSType API to Resolver
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...main/kotlin/com/google/devtools/ksp/symbol/impl/synthetic/KSTypeReferenceSyntheticImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.google.devtools.ksp.symbol.impl.synthetic | ||
|
||
import com.google.devtools.ksp.symbol.* | ||
import com.google.devtools.ksp.symbol.impl.KSObjectCache | ||
|
||
class KSTypeReferenceSyntheticImpl(val ksType: KSType) : KSTypeReference { | ||
companion object : KSObjectCache<KSType, KSTypeReferenceSyntheticImpl>() { | ||
fun getCached(ksType: KSType) = KSTypeReferenceSyntheticImpl.cache.getOrPut(ksType) { KSTypeReferenceSyntheticImpl(ksType) } | ||
} | ||
|
||
override val annotations: List<KSAnnotation> = emptyList() | ||
|
||
override val element: KSReferenceElement? = null | ||
|
||
override val location: Location = NonExistLocation | ||
|
||
override val modifiers: Set<Modifier> = emptySet() | ||
|
||
override val origin: Origin = Origin.SYNTHETIC | ||
|
||
override fun <D, R> accept(visitor: KSVisitor<D, R>, data: D): R { | ||
return visitor.visitTypeReference(this, data) | ||
} | ||
|
||
override fun resolve(): KSType { | ||
return ksType | ||
} | ||
} |