FIR IDE: add helper function for getting psi of KtSymbol

This commit is contained in:
Ilya Kirillov
2021-02-02 18:42:31 +01:00
parent 99a6f24771
commit 0fbb5c60c9
@@ -16,6 +16,22 @@ interface KtSymbol : ValidityTokenOwner {
fun createPointer(): KtSymbolPointer<KtSymbol>
}
/**
* Get symbol [PsiElement] if its type is [PSI], otherwise throws ClassCastException
*
* @see KtSymbol.psi
*/
inline fun <reified PSI : PsiElement> KtSymbol.psi(): PSI =
psi as PSI
/**
* Get symbol [PsiElement] if its type is [PSI], otherwise null
*
* @see KtSymbol.psi
*/
inline fun <reified PSI : PsiElement> KtSymbol.psiSafe(): PSI? =
psi as? PSI
/**
* A place where [KtSymbol] came from
*/