[FIR] Use stubs to get context receiver list and name of label
Thirteenth step for ^KT-52615 Merge-request: KT-MR-8911 Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
@@ -24,7 +24,10 @@ class KtContextReceiver : KtElementImplStub<KotlinContextReceiverStub> {
|
|||||||
return targetLabel()?.getReferencedName()
|
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)
|
fun typeReference(): KtTypeReference? = getStubOrPsiChild(KtStubElementTypes.TYPE_REFERENCE)
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
package org.jetbrains.kotlin.psi
|
package org.jetbrains.kotlin.psi
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode
|
import com.intellij.lang.ASTNode
|
||||||
import org.jetbrains.kotlin.KtNodeTypes
|
|
||||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub
|
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ class KtContextReceiverList : KtElementImplStub<KotlinPlaceHolderStub<KtContextR
|
|||||||
return visitor.visitContextReceiverList(this, data)
|
return visitor.visitContextReceiverList(this, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun contextReceivers(): List<KtContextReceiver> = findChildrenByType(KtNodeTypes.CONTEXT_RECEIVER)
|
fun contextReceivers(): List<KtContextReceiver> = getStubOrPsiChildrenAsList(KtStubElementTypes.CONTEXT_RECEIVER)
|
||||||
|
|
||||||
fun typeReferences(): List<KtTypeReference> = contextReceivers().mapNotNull { it.typeReference() }
|
fun typeReferences(): List<KtTypeReference> = contextReceivers().mapNotNull { it.typeReference() }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user