Add "Add getter/setter" quick fix for uninitialized property

#KT-30078 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-03-19 17:18:20 +09:00
committed by Dmitry Gridin
parent efcc6f0967
commit f861b10798
17 changed files with 161 additions and 16 deletions
@@ -255,7 +255,10 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
}
fun createPropertyGetter(expression: KtExpression): KtPropertyAccessor {
val property = createProperty("val x get() = 1")
val property = if (expression is KtBlockExpression)
createProperty("val x get() {\nreturn 1\n}")
else
createProperty("val x get() = 1")
val getter = property.getter!!
val bodyExpression = getter.bodyExpression!!