Search in sources :

Example 1 with KotlinTypeProjectionStub

use of org.jetbrains.kotlin.psi.stubs.KotlinTypeProjectionStub in project kotlin by JetBrains.

the class KtTypeProjection method getProjectionKind.

@NotNull
public KtProjectionKind getProjectionKind() {
    KotlinTypeProjectionStub stub = getStub();
    if (stub != null) {
        return stub.getProjectionKind();
    }
    PsiElement projectionToken = getProjectionToken();
    IElementType token = projectionToken != null ? projectionToken.getNode().getElementType() : null;
    for (KtProjectionKind projectionKind : KtProjectionKind.values()) {
        if (projectionKind.getToken() == token) {
            return projectionKind;
        }
    }
    throw new IllegalStateException(projectionToken.getText());
}
Also used : IElementType(com.intellij.psi.tree.IElementType) KotlinTypeProjectionStub(org.jetbrains.kotlin.psi.stubs.KotlinTypeProjectionStub) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 IElementType (com.intellij.psi.tree.IElementType)1 NotNull (org.jetbrains.annotations.NotNull)1 KotlinTypeProjectionStub (org.jetbrains.kotlin.psi.stubs.KotlinTypeProjectionStub)1