Replace map + filterNotNull -> mapNotNull in project

This commit is contained in:
Alexander Udalov
2016-02-20 17:33:39 +03:00
parent 61f5e2f9cf
commit 1a5a077bd6
19 changed files with 52 additions and 54 deletions
@@ -22,6 +22,7 @@ import com.intellij.psi.util.PsiTreeUtil
import com.intellij.util.SmartFMap
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.cfg.ControlFlowBuilder.PredefinedOperation.*
import org.jetbrains.kotlin.cfg.pseudocode.ControlFlowInstructionsGenerator
import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue
import org.jetbrains.kotlin.cfg.pseudocode.Pseudocode
@@ -31,30 +32,30 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.InstructionWithValu
import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.MagicKind
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
import org.jetbrains.kotlin.diagnostics.Errors.*
import org.jetbrains.kotlin.lexer.KtToken
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.lexer.KtTokens.*
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.*
import org.jetbrains.kotlin.psi.psiUtil.getQualifiedElementSelector
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.BindingContextUtils
import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.resolve.CompileTimeConstantUtils
import org.jetbrains.kotlin.resolve.calls.callUtil.*
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatch
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
import org.jetbrains.kotlin.types.expressions.OperatorConventions
import java.util.*
import org.jetbrains.kotlin.cfg.ControlFlowBuilder.PredefinedOperation.*
import org.jetbrains.kotlin.diagnostics.Errors.*
import org.jetbrains.kotlin.lexer.KtTokens.*
class ControlFlowProcessor(private val trace: BindingTrace) {
private val builder: ControlFlowBuilder = ControlFlowInstructionsGenerator()
@@ -202,7 +203,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) {
}
private fun elementsToValues(from: List<KtElement?>): List<PseudoValue> {
return from.map { element -> getBoundOrUnreachableValue(element) }.filterNotNull()
return from.mapNotNull { element -> getBoundOrUnreachableValue(element) }
}
private fun generateInitializer(declaration: KtDeclaration, initValue: PseudoValue) {
@@ -1268,7 +1269,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) {
private fun generateCallOrMarkUnresolved(call: KtCallElement) {
if (!generateCall(call)) {
val arguments = call.valueArguments.map { valueArgument -> valueArgument.getArgumentExpression() }.filterNotNull()
val arguments = call.valueArguments.mapNotNull { valueArgument -> valueArgument.getArgumentExpression() }
for (argument in arguments) {
generateInstructions(argument)
@@ -105,7 +105,7 @@ class ConstraintSystemBuilderImpl : ConstraintSystem.Builder {
}
internal fun getNestedTypeVariables(type: KotlinType): List<TypeVariable> =
type.getNestedTypeParameters().map { getMyTypeVariable(it) }.filterNotNull()
type.getNestedTypeParameters().mapNotNull { getMyTypeVariable(it) }
override fun addSubtypeConstraint(constrainingType: KotlinType?, subjectType: KotlinType?, constraintPosition: ConstraintPosition) {
addConstraint(SUB_TYPE, constrainingType, subjectType, ConstraintContext(constraintPosition, initial = true))
@@ -57,7 +57,7 @@ internal fun KotlinType.getNestedArguments(): List<TypeProjection> {
}
internal fun KotlinType.getNestedTypeParameters(): List<TypeParameterDescriptor> {
return getNestedArguments().map { typeProjection ->
return getNestedArguments().mapNotNull { typeProjection ->
typeProjection.type.constructor.declarationDescriptor as? TypeParameterDescriptor
}.filterNotNull()
}
}
@@ -268,7 +268,7 @@ class BindingContextSuppressCache(val context: BindingContext) : KotlinSuppressC
return descriptor.annotations.toList()
}
else {
return annotated.annotationEntries.map { context.get(BindingContext.ANNOTATION, it) }.filterNotNull()
return annotated.annotationEntries.mapNotNull { context.get(BindingContext.ANNOTATION, it) }
}
}
}
}