Fix compiler errors in nj2k detected after changes in NI

This commit is contained in:
Dmitriy Novozhilov
2019-05-29 16:53:34 +03:00
parent dc5f4ab240
commit 5843336d42
2 changed files with 4 additions and 12 deletions
@@ -235,16 +235,7 @@ class JavaToJKTreeBuilder constructor(
fun IElementType.toJK(): JKOperator = JKJavaOperatorImpl.tokenToOperator[this] ?: error("Unsupported token-type: $this")
fun PsiPrefixExpression.toJK(): JKExpression {
return JKPrefixExpressionImpl(operand.toJK(), operationSign.tokenType.toJK()).let {
if (it.operator.token in listOf(JavaTokenType.PLUS, JavaTokenType.MINUS)
&& it.expression is JKLiteralExpression
) {
JKJavaLiteralExpressionImpl(
it.operator.token.text + (it.expression as JKLiteralExpression).literal,
(it.expression as JKLiteralExpression).type
)
} else it
}.also {
return JKPrefixExpressionImpl(operand.toJK(), operationSign.tokenType.toJK()).also {
it.assignNonCodeElements(this)
}
}
@@ -93,8 +93,9 @@ private class DebugTreePrinter : JKVisitorVoid {
}
fun printSymbol(symbol: JKSymbol) {
if (symbol is JKUniverseSymbol<*>) {
printer.printWithNoIndent(symbol.target.describe())
val target = symbol.target
if (target is JKTreeElement) {
printer.printWithNoIndent(target.describe())
} else {
printer.printWithNoIndent("Psi")
}