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
@@ -7,6 +7,4 @@ fun test() {
val n = i(property)
}
private fun i(property: String?): Int? {
return property?.length()
}
private fun i(property: String?) = property?.length()
@@ -7,6 +7,4 @@ fun test() {
val n = i(property)
}
private fun i(property: String): Int {
return property.length()
}
private fun i(property: String) = property.length()
@@ -19,6 +19,4 @@ public class A(): Z() {
}
}
private fun i(a1: A, b1: A.B): Int {
return a1.a + b1.b + a1.z + b1.z
}
private fun i(a1: A, b1: A.B) = a1.a + b1.b + a1.z + b1.z
@@ -7,6 +7,4 @@ fun Z.foo(): Int {
return i() + 1
}
private fun Z.i(): Int {
return this.a
}
private fun Z.i() = this.a
@@ -19,6 +19,4 @@ public class A(): Z() {
}
}
private fun i(a1: A, b1: A.B): Int {
return a1.a + b1.b + b1.z
}
private fun i(a1: A, b1: A.B) = a1.a + b1.b + b1.z
@@ -19,6 +19,4 @@ public class A(): Z() {
}
}
private fun i(a1: A, b1: A.B): Int {
return a1.a + b1.b + a1.z + b1.z
}
private fun i(a1: A, b1: A.B) = a1.a + b1.b + a1.z + b1.z
@@ -7,6 +7,4 @@ fun Z.foo(): Int {
return i() + 1
}
private fun Z.i(): Int {
return this.a + a
}
private fun Z.i() = this.a + a
@@ -7,6 +7,4 @@ fun Z.foo(): Int {
return i() + 1
}
private fun Z.i(): Int {
return a
}
private fun Z.i() = a
@@ -19,6 +19,4 @@ public class A(): Z() {
}
}
private fun i(a1: A, b1: A.B): Int {
return a1.a + b1.b + b1.z
}
private fun i(a1: A, b1: A.B) = a1.a + b1.b + b1.z
@@ -9,9 +9,7 @@ class A {
fun B.foo() = i(this@A, this)
}
private fun i(a1: A, b: B): Int {
return a1.a + b.b
}
private fun i(a1: A, b: B) = a1.a + b.b
class B {
val b = 1
@@ -9,6 +9,4 @@ fun foo(t: Array<Array<Int>>) {
}
}
private fun i(it: Int): Int {
return it + 1
}
private fun i(it: Int) = it + 1
@@ -9,6 +9,4 @@ fun foo(t: Array<Int>) {
}
}
private fun b(t: Array<Int>): Boolean {
return t.check { it + 1 > 1 }
}
private fun b(t: Array<Int>) = t.check { it + 1 > 1 }
@@ -9,6 +9,4 @@ fun foo(t: Array<Array<Int>>) {
}
}
private fun b(it: Array<Int>): Boolean {
return it.check { it + 1 > 1 }
}
private fun b(it: Array<Int>) = it.check { it + 1 > 1 }
@@ -9,6 +9,4 @@ fun foo(t: Array<Int>) {
}
}
private fun i(it: Int): Int {
return it + 1
}
private fun i(it: Int) = it + 1
@@ -9,6 +9,4 @@ fun foo(a: Int, b: Int, c: Int): Int {
return i(a, b, c)
}
private fun i(a: Int, b: Int, c: Int): Int {
return (a + b * a - c) + b * c
}
private fun i(a: Int, b: Int, c: Int) = (a + b * a - c) + b * c
@@ -13,9 +13,7 @@ public class A() {
}
}
private fun i(a: A, t: Int, u: Int, x: Int): Int {
return a.bar(t - x, u + x)
}
private fun i(a: A, t: Int, u: Int, x: Int) = a.bar(t - x, u + x)
fun foo(a: A, x: Int): Int {
val t = 10