Kotlin Uast, Minor: support PsiElementBacked in KotlinUType
This commit is contained in:
@@ -181,7 +181,7 @@ internal object KotlinConverter : UastConverter {
|
|||||||
if (typeReference == null) return UastErrorType
|
if (typeReference == null) return UastErrorType
|
||||||
val bindingContext = typeReference.analyze(BodyResolveMode.PARTIAL)
|
val bindingContext = typeReference.analyze(BodyResolveMode.PARTIAL)
|
||||||
val type = bindingContext[BindingContext.TYPE, typeReference] ?: return UastErrorType
|
val type = bindingContext[BindingContext.TYPE, typeReference] ?: return UastErrorType
|
||||||
return convert(type, typeReference.project, parent)
|
return KotlinUType(type, typeReference.project, parent, typeReference.typeElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun asSimpleReference(element: PsiElement?, parent: UElement): USimpleReferenceExpression? {
|
internal fun asSimpleReference(element: PsiElement?, parent: UElement): USimpleReferenceExpression? {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.uast
|
package org.jetbrains.kotlin.uast
|
||||||
|
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.name.FqNameUnsafe
|
import org.jetbrains.kotlin.name.FqNameUnsafe
|
||||||
@@ -24,12 +25,14 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
|||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.uast.*
|
import org.jetbrains.uast.*
|
||||||
|
import org.jetbrains.uast.psi.PsiElementBacked
|
||||||
|
|
||||||
class KotlinUType(
|
class KotlinUType(
|
||||||
val type: KotlinType,
|
val type: KotlinType,
|
||||||
val project: Project,
|
val project: Project,
|
||||||
override val parent: UElement?
|
override val parent: UElement?,
|
||||||
) : KotlinAbstractUElement(), UType {
|
override val psi: PsiElement? = null
|
||||||
|
) : KotlinAbstractUElement(), UType, PsiElementBacked {
|
||||||
override val name: String
|
override val name: String
|
||||||
get() = type.toString()
|
get() = type.toString()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user