Unify building references to symbols in html fir dump

This commit is contained in:
Simon Ogorodnik
2019-04-25 14:04:34 +03:00
committed by Mikhail Glukhikh
parent 0c0f45791b
commit e41a79fbe9
@@ -610,9 +610,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
private fun FlowContent.generate(type: ConeClassType) { private fun FlowContent.generate(type: ConeClassType) {
resolved { resolved {
val link = linkResolver.classLocation(type.lookupTag.classId) symbolRef(type.lookupTag.toSymbol(session)) {
declarationRef(link, setOf("class-fqn")) {
title = type.lookupTag.classId.asString()
fqn(type.lookupTag.classId.relativeClassName) fqn(type.lookupTag.classId.relativeClassName)
} }
} }
@@ -908,8 +906,12 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
} }
private fun FlowContent.symbolRef(symbol: ConeSymbol?, body: FlowContent.() -> Unit) { private fun FlowContent.symbolRef(symbol: ConeSymbol?, body: FlowContent.() -> Unit) {
val link = if (symbol == null) null else linkResolver.nearSymbolLocation(symbol) val (link, classes) = when (symbol) {
declarationRef(link, setOf("symbol")) { null -> null to setOf()
is ConeClassLikeSymbol -> linkResolver.classLocation(symbol.classId) to setOf("class-fqn")
else -> linkResolver.nearSymbolLocation(symbol) to setOf("symbol")
}
declarationRef(link, classes) {
if (symbol != null) { if (symbol != null) {
title = symbol.describe() title = symbol.describe()
} }