Extraction Engine: Generate function/property accessor with expression body (whenever applicable)

#KT-6405 Fixed
This commit is contained in:
Alexey Sedunov
2015-03-12 16:15:35 +03:00
parent 9d8cfd04d9
commit 9cb42944d1
92 changed files with 142 additions and 295 deletions
@@ -8,6 +8,4 @@ fun foo(a: Int): Int {
return if (b(a, b)) 1 else if (a - b < 0) 2 else b
}
private fun b(a: Int, b: Int): Boolean {
return a + b > 0
}
private fun b(a: Int, b: Int) = a + b > 0
@@ -8,6 +8,4 @@ fun foo(a: Int): Int {
return if (a + b > 0) 1 else i(a, b)
}
private fun i(a: Int, b: Int): Int {
return if (a - b < 0) 2 else b
}
private fun i(a: Int, b: Int) = if (a - b < 0) 2 else b
@@ -4,6 +4,4 @@ fun foo(a: Int): Int {
return if (a + b > 0) i() else if (a - b < 0) 2 else b
}
private fun i(): Int {
return 1
}
private fun i() = 1
@@ -10,6 +10,4 @@ fun foo(a: Int): Int {
}
}
private fun i(b: Int): Int {
return b
}
private fun i(b: Int) = b
@@ -8,6 +8,4 @@ fun foo(a: Int): Int {
}
}
private fun i(): Int {
return 0
}
private fun i() = 0
@@ -12,6 +12,4 @@ fun foo(a: Int): Int {
}
}
private fun i(a: Int, b: Int): Int {
return a + b
}
private fun i(a: Int, b: Int) = a + b
@@ -5,6 +5,4 @@
// SIBLING:
fun foo(a: Int, b: Int): Int = i(a, b)
private fun i(a: Int, b: Int): Int {
return a + b
}
private fun i(a: Int, b: Int) = a + b
@@ -8,6 +8,4 @@ fun foo(a: Int): Int {
return i(a, b)
}
private fun i(a: Int, b: Int): Int {
return if (a + b > 0) 1 else if (a - b < 0) 2 else b
}
private fun i(a: Int, b: Int) = if (a + b > 0) 1 else if (a - b < 0) 2 else b
@@ -8,6 +8,4 @@ fun foo(a: Int): Int {
return i(a, b)
}
private fun i(a: Int, b: Int): Int {
return a + b
}
private fun i(a: Int, b: Int) = a + b
@@ -5,6 +5,4 @@ fun foo(t: Array<Int>) {
t.check(function())
}
private fun function(): (Int) -> Boolean {
return { it + 1 > 1 }
}
private fun function() = { it + 1 > 1 }
@@ -5,6 +5,4 @@ fun foo(t: Array<Int>) {
t.check(function())
}
private fun function(): (Int) -> Boolean {
return { it + 1 > 1 }
}
private fun function() = { it + 1 > 1 }
@@ -5,6 +5,4 @@ fun foo(t: Array<Int>) {
t.check(1, 2, function())
}
private fun function(): (Int) -> Boolean {
return { it + 1 > 1 }
}
private fun function() = { it + 1 > 1 }
@@ -5,6 +5,4 @@ fun foo(t: Array<Int>) {
t.check(a = 1, b = 2, f = function())
}
private fun function(): (Int) -> Boolean {
return { it + 1 > 1 }
}
private fun function() = { it + 1 > 1 }