Rework deparenthesize-like methods

- Extract private `deparenthesizeOnce` and repeat it until get the same expression

- Drop redundant parameter `deparenthesizeRecursively`

- Drop some usages of `safeDeparenthesize` in `deparenthesize`
  because even if `deparenthesize` returns null (i.e. something was not parsed)
  there is no sense in working with such expressions

Note, that `deparenthesize` now unwraps nested labels' declaration (see changes in testData),
but it seems to be reasonable
This commit is contained in:
Denis Zharkov
2015-05-05 12:20:26 +03:00
parent b72a3de86e
commit 9101505eca
6 changed files with 38 additions and 19 deletions
@@ -82,4 +82,15 @@ class C {
}
a<!UNSAFE_CALL!>.<!>compareTo("2")
}
fun twoLabelsOnLoop() {
label1@ label2@ for (i in 1..100) {
if (i > 0) {
break@label1
}
else {
break@label2
}
}
}
}
@@ -12,5 +12,6 @@ internal final class C {
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun notContainsBreak(/*0*/ a: kotlin.String?, /*1*/ b: kotlin.String?): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal final fun twoLabelsOnLoop(): kotlin.Unit
internal final fun unresolvedBreak(/*0*/ a: kotlin.String?, /*1*/ array: kotlin.Array<kotlin.Int>): kotlin.Unit
}