Android: Add inspection & quickfix to convert findViewById to api 26

#KT-19940 Fixed Target Version 1.1.5
This commit is contained in:
Vyacheslav Gerasimov
2017-08-30 18:19:58 +03:00
parent be900a76d8
commit 5220dfc0ad
15 changed files with 303 additions and 13 deletions
@@ -533,6 +533,15 @@ fun KtCallExpression.getOrCreateValueArgumentList(): KtValueArgumentList {
typeArgumentList ?: calleeExpression) as KtValueArgumentList
}
fun KtCallExpression.addTypeArgument(typeArgument: KtTypeProjection) {
if (typeArgumentList != null) {
typeArgumentList?.addArgument(typeArgument)
}
else {
addAfter(KtPsiFactory(this).createTypeArguments("<${typeArgument.text}>"), calleeExpression)
}
}
fun KtDeclaration.hasBody() = when (this) {
is KtFunction -> hasBody()
is KtProperty -> hasBody()