KT-19126 Add convert property initializer to getter in interfaces (#1224)
This commit is contained in:
committed by
Dmitry Jemerov
parent
2536615e0e
commit
666c241479
@@ -261,6 +261,15 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
|
||||
return getter
|
||||
}
|
||||
|
||||
fun createPropertySetter(expression: KtExpression): KtPropertyAccessor {
|
||||
val property = createProperty("val x get() = 1\nset(value) = TODO()")
|
||||
val setter = property.setter!!
|
||||
val bodyExpression = setter.bodyExpression!!
|
||||
|
||||
bodyExpression.replace(expression)
|
||||
return setter
|
||||
}
|
||||
|
||||
fun createDestructuringDeclaration(text: String): KtDestructuringDeclaration {
|
||||
return (createFunction("fun foo() {$text}").bodyExpression as KtBlockExpression).statements.first() as KtDestructuringDeclaration
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user