Add intentions to convert lazy <--> ordinary property

#KT-23501 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-04-17 10:02:02 +03:00
committed by Mikhail Glukhikh
parent a2205cfc98
commit fbd992f8c7
55 changed files with 280 additions and 0 deletions
@@ -278,6 +278,14 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
bodyExpression.replace(expression)
return setter
}
fun createPropertyDelegate(expression: KtExpression): KtPropertyDelegate {
val property = createProperty("val x by lazy { 1 }")
val delegate = property.delegate!!
val delegateExpression = delegate.expression!!
delegateExpression.replace(expression)
return delegate
}
fun createDestructuringDeclaration(text: String): KtDestructuringDeclaration {
return createFunction("fun foo() {$text}").bodyBlockExpression!!.statements.first() as KtDestructuringDeclaration