Converter:

Fix assert statement
This commit is contained in:
Pavel V. Talanov
2013-11-19 14:33:15 +04:00
parent 21bc2887d2
commit f9586581a9
7 changed files with 11 additions and 11 deletions
@@ -17,12 +17,12 @@
package org.jetbrains.jet.j2k.ast
public open class AssertStatement(val condition: Expression, val detail: Expression) : Statement() {
public class AssertStatement(val condition: Expression, val detail: Expression) : Statement() {
public override fun toKotlin(): String {
var detail: String? = (if (detail != Expression.EMPTY_EXPRESSION)
"(" + detail.toKotlin() + ")"
val lazyStringMessage = if (detail != Expression.EMPTY_EXPRESSION)
" {" + detail.toKotlin() + "}"
else
"")
return "assert" + detail + " {" + condition.toKotlin() + "}"
""
return "assert(${condition.toKotlin()})$lazyStringMessage"
}
}
@@ -1 +1 @@
assert {boolMethod()}
assert(boolMethod())
@@ -1 +1 @@
assert {boolMethod()}
assert(boolMethod())
@@ -1 +1 @@
assert {(boolMethod())}
assert((boolMethod()))
@@ -1 +1 @@
assert {(boolMethod())}
assert((boolMethod()))
@@ -1 +1 @@
assert("string details") {true}
assert(true) {"string details"}
@@ -1 +1 @@
assert("string details") {true}
assert(true) {"string details"}