Minor: Use kotlin.lazy instead of kotlin.Delegates.lazy in KtPsiFactory.CallableBuilder
This commit is contained in:
@@ -533,7 +533,7 @@ public class KtPsiFactory(private val project: Project) {
|
||||
public fun lazyBody(body: String): CallableBuilder {
|
||||
assert(target == Target.READ_ONLY_PROPERTY && (state == State.BODY || state == State.TYPE_CONSTRAINTS))
|
||||
|
||||
sb.append(" by kotlin.properties.Delegates.lazy {\n").append(body).append("\n}")
|
||||
sb.append(" by kotlin.lazy {\n").append(body).append("\n}")
|
||||
state = State.DONE
|
||||
|
||||
return this
|
||||
|
||||
+1
-3
@@ -1,9 +1,7 @@
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
// WITH_RUNTIME
|
||||
// EXTRACTION_TARGET: lazy property
|
||||
class A {
|
||||
private val i: Int by Delegates.lazy {
|
||||
private val i: Int by lazy {
|
||||
val a = 1 + 2
|
||||
val b = a * 2
|
||||
b
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
// WITH_RUNTIME
|
||||
// EXTRACTION_TARGET: lazy property
|
||||
|
||||
class A(val n: Int = 1) {
|
||||
val m: Int = 2
|
||||
|
||||
private val i: Int by Delegates.lazy {
|
||||
private val i: Int by lazy {
|
||||
m + n + 1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
// WITH_RUNTIME
|
||||
// EXTRACTION_TARGET: lazy property
|
||||
|
||||
val n: Int = 1
|
||||
|
||||
private val i: Int by Delegates.lazy {
|
||||
private val i: Int by lazy {
|
||||
n + 1
|
||||
}
|
||||
|
||||
fun foo(): Int {
|
||||
return i
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
// WITH_RUNTIME
|
||||
// EXTRACTION_TARGET: lazy property
|
||||
|
||||
class A(val n: Int = 1) {
|
||||
val m: Int = 2
|
||||
|
||||
private val i: Int by Delegates.lazy {
|
||||
private val i: Int by lazy {
|
||||
println(n)
|
||||
m + n + 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user