FIR IDE: add helper function for getting psi of KtSymbol
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user