Replace single line let: application on IDEA + front-end modules

This commit is contained in:
Mikhail Glukhikh
2016-11-14 14:05:15 +03:00
parent 09ae1f1a5d
commit b850d71e17
4 changed files with 8 additions and 12 deletions
@@ -42,7 +42,8 @@ class FileScopeProviderImpl(
) : FileScopeProvider {
private val cache = storageManager.createMemoizedFunction<KtFile, FileScopes> { file ->
val scopes = (file.originalFile as KtFile?)?.fileScopesCustomizer?.let { it.createFileScopes(fileScopeFactory) } ?: fileScopeFactory.createScopesForFile(file)
val scopes = (file.originalFile as KtFile?)?.fileScopesCustomizer?.createFileScopes(fileScopeFactory)
?: fileScopeFactory.createScopesForFile(file)
bindingTrace.recordScope(scopes.lexicalScope, file)
scopes
}
@@ -64,7 +64,7 @@ class KotlinIntroduceParameterMethodUsageProcessor : IntroduceParameterMethodUsa
data.parametersToRemove.toNativeArray().sortedDescending().forEach { changeInfo.removeParameter(it) }
// Temporarily assume that the new parameter is of Any type. Actual type is substituted during the signature update phase
val defaultValueForCall = (data.parameterInitializer.expression as? PsiExpression)?.let { it.j2k() }
val defaultValueForCall = (data.parameterInitializer.expression as? PsiExpression)?.j2k()
changeInfo.addParameter(KotlinParameterInfo(callableDescriptor = psiMethodDescriptor,
name = data.parameterName,
originalTypeInfo = KotlinTypeInfo(false, psiMethodDescriptor.builtIns.anyType),
@@ -386,11 +386,9 @@ fun <T> chooseContainerElement(
else -> null
} ?: return null
val name = renderName()
val params = (descriptor as? FunctionDescriptor)?.let { descriptor ->
descriptor.valueParameters
.map { DescriptorRenderer.Companion.SHORT_NAMES_IN_TYPES.renderType(it.type) }
.joinToString(", ", "(", ")")
} ?: ""
val params = (descriptor as? FunctionDescriptor)?.valueParameters
?.map { DescriptorRenderer.Companion.SHORT_NAMES_IN_TYPES.renderType(it.type) }
?.joinToString(", ", "(", ")") ?: ""
return "$name$params"
}
@@ -158,11 +158,8 @@ class KotlinSafeDeleteProcessor : JavaSafeDeleteProcessor() {
val referencedElement = reference.element
val argList = referencedElement.getNonStrictParentOfType<KtUserType>()?.let { jetType ->
jetType.typeArgumentList
} ?: referencedElement.getNonStrictParentOfType<KtCallExpression>()?.let { callExpression ->
callExpression.typeArgumentList
} ?: null
val argList = referencedElement.getNonStrictParentOfType<KtUserType>()?.typeArgumentList
?: referencedElement.getNonStrictParentOfType<KtCallExpression>()?.typeArgumentList
if (argList != null) {
val projections = argList.arguments