HL API: fix renderer for package symbols
This commit is contained in:
committed by
teamcityserver
parent
84bd347841
commit
eb69153fbc
+18
-8
@@ -30,15 +30,25 @@ internal class KtFirSymbolDeclarationRendererProvider(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun render(symbol: KtSymbol, options: KtDeclarationRendererOptions): String {
|
override fun render(symbol: KtSymbol, options: KtDeclarationRendererOptions): String {
|
||||||
require(symbol is KtFirSymbol<*>)
|
return when (symbol) {
|
||||||
val containingSymbol = with(analysisSession) {
|
is KtPackageSymbol -> {
|
||||||
(symbol as? KtSymbolWithKind)?.getContainingSymbol()
|
"package ${symbol.fqName.asString()}"
|
||||||
}
|
}
|
||||||
check(containingSymbol is KtFirSymbol<*>?)
|
is KtFirSymbol<*> -> {
|
||||||
|
val containingSymbol = with(analysisSession) {
|
||||||
|
(symbol as? KtSymbolWithKind)?.getContainingSymbol()
|
||||||
|
}
|
||||||
|
check(containingSymbol is KtFirSymbol<*>?)
|
||||||
|
|
||||||
return symbol.firRef.withFir(FirResolvePhase.BODY_RESOLVE) { fir ->
|
symbol.firRef.withFir(FirResolvePhase.BODY_RESOLVE) { fir ->
|
||||||
val containingFir = containingSymbol?.firRef?.withFirUnsafe { it }
|
val containingFir = containingSymbol?.firRef?.withFirUnsafe { it }
|
||||||
FirIdeRenderer.render(fir, containingFir, options, fir.moduleData.session)
|
FirIdeRenderer.render(fir, containingFir, options, fir.moduleData.session)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
error("Unexpected Fir Symbol ${symbol::class.simpleName}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user