Merge branch 'KT-5115' of https://github.com/mcgee/kotlin into mcgee-KT-5115

This commit is contained in:
Dmitry Jemerov
2015-11-17 15:14:00 +01:00
12 changed files with 149 additions and 0 deletions
@@ -180,6 +180,15 @@ public class KtPsiFactory(private val project: Project) {
return createDeclaration(text)
}
public fun createPropertyGetter(expression: KtExpression): KtPropertyAccessor {
val property = createProperty("val x get() = 1")
val getter = property.getter!!
val bodyExpression = getter.bodyExpression!!
bodyExpression.replace(expression)
return getter
}
public fun <TDeclaration : KtDeclaration> createDeclaration(text: String): TDeclaration {
val file = createFile(text)
val declarations = file.getDeclarations()