[FIR] Add unresolved type counter to html dump
This commit is contained in:
@@ -90,6 +90,11 @@ body.dark {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.dark .unresolved-counter {
|
||||
color: #d42eff;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.dark .diagnostic-hover {
|
||||
background-color: #3a3a3a;
|
||||
color: #dfdfdf;
|
||||
|
||||
@@ -80,6 +80,11 @@
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.white .unresolved-counter {
|
||||
color: #d42eff;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.white .diagnostic-hover {
|
||||
background-color: #eaeaea;
|
||||
color: #000;
|
||||
|
||||
@@ -80,6 +80,7 @@ private class PackageInfo(val fqName: FqName, val moduleInfo: ModuleInfo) {
|
||||
}
|
||||
val errors = mutableMapOf<String, Int>().withDefault { 0 }
|
||||
val implicits = mutableMapOf<String, Int>().withDefault { 0 }
|
||||
val unresolved = mutableMapOf<String, Int>().withDefault { 0 }
|
||||
}
|
||||
|
||||
private class ModuleInfo(val name: String, outputRoot: File) {
|
||||
@@ -93,6 +94,9 @@ private class ModuleInfo(val name: String, outputRoot: File) {
|
||||
val implicits: Map<FqName, Int> by lazy {
|
||||
packages.mapValues { (_, packageInfo) -> packageInfo.implicits.values.sum() }.withDefault { 0 }
|
||||
}
|
||||
val unresolved: Map<FqName, Int> by lazy {
|
||||
packages.mapValues { (_, packageInfo) -> packageInfo.unresolved.values.sum() }.withDefault { 0 }
|
||||
}
|
||||
}
|
||||
|
||||
private class SupplementaryGenerator(val outputRoot: File) {
|
||||
@@ -122,7 +126,11 @@ private class SupplementaryGenerator(val outputRoot: File) {
|
||||
) {
|
||||
+packageInfo.fqName.asString()
|
||||
}
|
||||
addErrors(moduleInfo.errors.getValue(packageInfo.fqName), moduleInfo.implicits.getValue(packageInfo.fqName))
|
||||
addErrors(
|
||||
moduleInfo.errors.getValue(packageInfo.fqName),
|
||||
moduleInfo.implicits.getValue(packageInfo.fqName),
|
||||
moduleInfo.unresolved.getValue(packageInfo.fqName)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,13 +138,16 @@ private class SupplementaryGenerator(val outputRoot: File) {
|
||||
}
|
||||
}
|
||||
|
||||
fun LI.addErrors(errors: Int, implicits: Int) {
|
||||
fun LI.addErrors(errors: Int, implicits: Int, unresolved: Int) {
|
||||
if (errors > 0) {
|
||||
span(classes = "error-counter") { +(errors.toString()) }
|
||||
}
|
||||
if (implicits > 0) {
|
||||
span(classes = "implicit-counter") { +(implicits.toString()) }
|
||||
}
|
||||
if (unresolved > 0) {
|
||||
span(classes = "unresolved-counter") { +(unresolved.toString()) }
|
||||
}
|
||||
}
|
||||
|
||||
fun linkToIndex(moduleInfo: ModuleInfo, from: File): String {
|
||||
@@ -174,7 +185,11 @@ private class SupplementaryGenerator(val outputRoot: File) {
|
||||
for (file in packageInfo.contents) {
|
||||
li {
|
||||
a(href = "./$file.fir.html", classes = "container-ref") { +file }
|
||||
addErrors(packageInfo.errors.getValue(file), packageInfo.implicits.getValue(file))
|
||||
addErrors(
|
||||
packageInfo.errors.getValue(file),
|
||||
packageInfo.implicits.getValue(file),
|
||||
packageInfo.unresolved.getValue(file)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,7 +212,11 @@ private class SupplementaryGenerator(val outputRoot: File) {
|
||||
for (module in modules) {
|
||||
li {
|
||||
a(href = linkToIndex(module, outputRoot), classes = "container-ref") { +module.name }
|
||||
addErrors(module.errors.values.sum(), module.implicits.values.sum())
|
||||
addErrors(
|
||||
module.errors.values.sum(),
|
||||
module.implicits.values.sum(),
|
||||
module.unresolved.values.sum()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -304,6 +323,7 @@ class MultiModuleHtmlFirDump(private val outputRoot: File) {
|
||||
packageForFile(file).apply {
|
||||
errors[file.name] = dumper.errors
|
||||
implicits[file.name] = dumper.implicits
|
||||
unresolved[file.name] = dumper.unresolved
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,9 +426,13 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
||||
var implicits: Int = 0
|
||||
private set
|
||||
|
||||
var unresolved: Int = 0
|
||||
private set
|
||||
|
||||
fun generate(element: FirFile, builder: StringBuilder) {
|
||||
errors = 0
|
||||
implicits = 0
|
||||
unresolved = 0
|
||||
builder.appendHTML().html {
|
||||
generate(element)
|
||||
}
|
||||
@@ -810,6 +834,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
||||
keyword("<implicit>")
|
||||
}
|
||||
is FirUserTypeRef -> unresolved {
|
||||
unresolved++
|
||||
generateList(typeRef.qualifier, separator = ".") {
|
||||
simpleName(it.name)
|
||||
generateTypeProjections(it.typeArguments)
|
||||
|
||||
Reference in New Issue
Block a user