diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtContextReceiver.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtContextReceiver.kt index 71e34457c0f..e2c35770599 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtContextReceiver.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtContextReceiver.kt @@ -24,7 +24,10 @@ class KtContextReceiver : KtElementImplStub { return targetLabel()?.getReferencedName() } - fun labelNameAsName(): Name? = targetLabel()?.getReferencedNameAsName() + fun labelNameAsName(): Name? { + stub?.let { stub -> return stub.getLabel()?.let { Name.identifier(it) } } + return targetLabel()?.getReferencedNameAsName() + } fun typeReference(): KtTypeReference? = getStubOrPsiChild(KtStubElementTypes.TYPE_REFERENCE) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtContextReceiverList.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtContextReceiverList.kt index f11258a79e7..18d8f05a755 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtContextReceiverList.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtContextReceiverList.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.psi import com.intellij.lang.ASTNode -import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes @@ -18,7 +17,7 @@ class KtContextReceiverList : KtElementImplStub = findChildrenByType(KtNodeTypes.CONTEXT_RECEIVER) + fun contextReceivers(): List = getStubOrPsiChildrenAsList(KtStubElementTypes.CONTEXT_RECEIVER) fun typeReferences(): List = contextReceivers().mapNotNull { it.typeReference() }