Intention to simplify for using destructing declaration

This commit is contained in:
Natalia Ukhorskaya
2016-01-13 14:47:02 +03:00
parent 5667a92472
commit ea3ba6f534
34 changed files with 631 additions and 0 deletions
@@ -216,6 +216,10 @@ class KtPsiFactory(private val project: Project) {
return (createFunction("fun foo() {$text}").bodyExpression as KtBlockExpression).statements.first() as KtDestructuringDeclaration
}
fun createDestructuringDeclarationInFor(text: String): KtDestructuringDeclaration {
return ((createFunction("fun foo() {for ($text in foo) {} }").bodyExpression as KtBlockExpression).statements.first() as KtForExpression).destructuringParameter!!
}
fun createDestructuringParameter(text: String): KtDestructuringDeclaration {
val dummyFun = createFunction("fun foo() { for ($text in foo) {} }")
return ((dummyFun.bodyExpression as KtBlockExpression).statements.first() as KtForExpression).destructuringParameter!!