Kotlin Uast, Minor: support PsiElementBacked in KotlinUType

This commit is contained in:
Yan Zhulanow
2016-03-22 21:02:06 +03:00
parent 1ac6c0f2e9
commit da5e6c4092
2 changed files with 6 additions and 3 deletions
@@ -181,7 +181,7 @@ internal object KotlinConverter : UastConverter {
if (typeReference == null) return UastErrorType
val bindingContext = typeReference.analyze(BodyResolveMode.PARTIAL)
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? {
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.uast
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.ClassDescriptor
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.types.KotlinType
import org.jetbrains.uast.*
import org.jetbrains.uast.psi.PsiElementBacked
class KotlinUType(
val type: KotlinType,
val project: Project,
override val parent: UElement?
) : KotlinAbstractUElement(), UType {
override val parent: UElement?,
override val psi: PsiElement? = null
) : KotlinAbstractUElement(), UType, PsiElementBacked {
override val name: String
get() = type.toString()