[VISUALIZER] Replace rendering of class with no name to anonymous
This commit is contained in:
committed by
TeamCityServer
parent
ca424a94ef
commit
813e48ffb4
+2
-2
@@ -130,8 +130,8 @@ class FirVisualizer(private val firFile: FirFile) : BaseRenderer() {
|
||||
stack.pop()
|
||||
}
|
||||
is KtClassOrObject -> {
|
||||
if (element.isLocal) stack.addName((element.name ?: "<no name provided>"))
|
||||
stack.push((element.name ?: "<no name provided>"))
|
||||
if (element.isLocal) stack.addName((element.name ?: "<anonymous>"))
|
||||
stack.push((element.name ?: "<anonymous>"))
|
||||
element.acceptChildren(this)
|
||||
stack.pop()
|
||||
}
|
||||
|
||||
+2
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.compiler.visualizer.Annotator.annotate
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
|
||||
import org.jetbrains.kotlin.renderer.ClassifierNamePolicy
|
||||
@@ -257,6 +258,7 @@ class PsiVisualizer(private val file: KtFile, analysisResult: AnalysisResult) :
|
||||
}
|
||||
|
||||
fun renderType(type: KotlinType): String {
|
||||
if (type.toString() == SpecialNames.NO_NAME_PROVIDED.asString()) return "<anonymous>"
|
||||
return typeRenderer.renderType(type)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// FIR_IGNORE
|
||||
fun test() {
|
||||
// test.<no name provided>
|
||||
// <anonymous>
|
||||
// │
|
||||
val x = object {}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ fun withLocals(p: Int): Int {
|
||||
// │ fun (Any).hashCode(): Int
|
||||
// │ │
|
||||
fun foo() = hashCode()
|
||||
// fun (withLocals.<no name provided>).foo(): Int
|
||||
// fun (<anonymous>).foo(): Int
|
||||
// │
|
||||
}).foo()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user