[VISUALIZER] Forbid to render unary minus for integer literals

This commit is contained in:
Ivan Kylchik
2021-02-20 16:14:51 +03:00
committed by TeamCityServer
parent 685f599c82
commit dd8a7010f0
3 changed files with 15 additions and 4 deletions
@@ -233,6 +233,14 @@ class PsiVisualizer(private val file: KtFile, analysisResult: AnalysisResult) :
addAnnotation(descriptorRenderer.render(it.type.constructor.declarationDescriptor!!), expression)
} ?: super.visitClassLiteralExpression(expression)
}
override fun visitPrefixExpression(expression: KtPrefixExpression) {
val opName = expression.operationReference.getReferencedName()
if (expression.baseExpression?.node?.elementType == KtNodeTypes.INTEGER_CONSTANT && opName == "-") {
return expression.baseExpression!!.accept(this)
}
super.visitPrefixExpression(expression)
}
}
inner class PsiDescriptorRenderer(