Convert Receiver to Parameter: Use template instead of the dialog

#KT-9490 Fixed
This commit is contained in:
Alexey Sedunov
2016-08-24 17:29:07 +03:00
parent 63092f6985
commit 639186ddae
5 changed files with 111 additions and 28 deletions
@@ -285,4 +285,11 @@ fun KtTypeParameterListOwner.addTypeParameter(typeParameter: KtTypeParameter): K
else -> null
} ?: return null
return (addAfter(list, leftAnchor) as KtTypeParameterList).parameters.first()
}
fun KtNamedFunction.getOrCreateValueParameterList(): KtParameterList {
valueParameterList?.let { return it }
val parameterList = KtPsiFactory(this).createParameterList("()")
val anchor = nameIdentifier ?: funKeyword!!
return addAfter(parameterList, anchor) as KtParameterList
}