Fix minor compile warnings

This commit is contained in:
Dmitry Gridin
2019-04-17 17:48:26 +07:00
parent 79793a4bda
commit 37c856290f
226 changed files with 618 additions and 479 deletions
@@ -133,7 +133,6 @@ object LightClassUtil {
.filter { it.kotlinOrigin === declaration }
private fun getWrappingClass(declaration: KtDeclaration): PsiClass? {
var declaration = declaration
if (declaration is KtParameter) {
val constructorClass = KtPsiUtil.getClassIfParameterIsProperty(declaration)
if (constructorClass != null) {
@@ -141,15 +140,16 @@ object LightClassUtil {
}
}
if (declaration is KtPropertyAccessor) {
declaration = declaration.property
var ktDeclaration = declaration
if (ktDeclaration is KtPropertyAccessor) {
ktDeclaration = ktDeclaration.property
}
if (declaration is KtConstructor<*>) {
return declaration.getContainingClassOrObject().toLightClass()
if (ktDeclaration is KtConstructor<*>) {
return ktDeclaration.getContainingClassOrObject().toLightClass()
}
val parent = declaration.parent
val parent = ktDeclaration.parent
if (parent is KtFile) {
// top-level declaration
@@ -474,7 +474,7 @@ open class KtUltraLightClass(classOrObject: KtClassOrObject, internal val suppor
}
private fun addReceiverParameter(callable: KtCallableDeclaration, method: KtUltraLightMethod) {
val receiver = callable.receiverTypeReference ?: return
if (callable.receiverTypeReference == null) return
method.delegate.addParameter(KtUltraLightReceiverParameter(callable, support, method))
}
@@ -103,8 +103,7 @@ class KtLightAnnotationForSourceEntry(
}
private fun getAttributeValue(name: String?, useDefault: Boolean): PsiAnnotationMemberValue? {
val name = name ?: "value"
val callEntry = getCallEntry(name) ?: return null
val callEntry = getCallEntry(name ?: "value") ?: return null
val valueArgument = callEntry.value.arguments.firstOrNull()
if (valueArgument != null) {
@@ -341,7 +340,7 @@ private fun KtElement.getResolvedCall(): ResolvedCall<out CallableDescriptor>? {
}
fun convertToLightAnnotationMemberValue(lightParent: PsiElement, argument: KtExpression): PsiAnnotationMemberValue {
val argument = unwrapCall(argument)
@Suppress("NAME_SHADOWING") val argument = unwrapCall(argument)
when (argument) {
is KtClassLiteralExpression -> {
return KtLightPsiClassObjectAccessExpression(argument, lightParent)
@@ -395,7 +394,7 @@ private fun unwrapCall(callee: KtExpression): KtExpression = when (callee) {
}
private fun getAnnotationName(callee: KtExpression): String? {
val callee = unwrapCall(callee)
@Suppress("NAME_SHADOWING") val callee = unwrapCall(callee)
val resultingDescriptor = callee.getResolvedCall()?.resultingDescriptor
if (resultingDescriptor is ClassConstructorDescriptor) {
val ktClass = resultingDescriptor.constructedClass.source.getPsi() as? KtClass