Formatter: introduce "Put left brace on new line option", support this option for "if/else" expressions

This commit is contained in:
Pavel V. Talanov
2014-01-13 16:45:54 +04:00
parent dab3cf37eb
commit 2d6f8aef4e
14 changed files with 213 additions and 25 deletions
@@ -0,0 +1,16 @@
fun main(args: Array<String>) {
if (true) {
false
} else if (false) {
true
} else {
}
if (true) {
}
if (true) {
}
}
// SET_FALSE: LBRACE_ON_NEXT_LINE
@@ -0,0 +1,28 @@
fun main(args: Array<String>) {
if (true)
{
false
} else if (false)
{
true
} else
{
}
if (true)
{
}
if (true)
{
}
}
// SET_FALSE: LBRACE_ON_NEXT_LINE
@@ -0,0 +1,21 @@
fun main(args: Array<String>) {
if (true)
{
false
} else if (false)
{
true
} else
{
}
if (true)
{
}
if (true)
{
}
}
// SET_TRUE: LBRACE_ON_NEXT_LINE
@@ -0,0 +1,22 @@
fun main(args: Array<String>) {
if (true) {
false
} else if (false) {
true
} else {
}
if (true)
{
}
if (true)
{
}
}
// SET_TRUE: LBRACE_ON_NEXT_LINE
@@ -0,0 +1,26 @@
fun main(args: Array<String>) {
if (true) // tricky comment
{
}
if (true) //tricky comment
{
}
if (true)
{
} else
// 1
/*2*/
/*3*/
{
}
}
// SET_FALSE: LBRACE_ON_NEXT_LINE
@@ -0,0 +1,24 @@
fun main(args: Array<String>) {
if (true) // tricky comment
{
}
if (true) //tricky comment
{
}
if (true) {
} else
// 1
/*2*/
/*3*/ {
}
}
// SET_FALSE: LBRACE_ON_NEXT_LINE
@@ -0,0 +1,26 @@
fun main(args: Array<String>) {
if (true) // tricky comment
{
}
if (true) //tricky comment
{
}
if (true) {
} else
// 1
/*2*/
/*3*/
{
}
}
// SET_FALSE: LBRACE_ON_NEXT_LINE
+3 -6
View File
@@ -19,15 +19,12 @@ fun f() {
} else {
}
if (true)
{
if (true) {
}
else
{
else {
}
if (true)
{
if (true) {
}
else