Minor. introduce method ExpressionReceiver.create and replace almost all usages of constructor ExpressionReceiver.

This commit is contained in:
Stanislav Erokhin
2015-11-15 21:48:38 +03:00
parent e606c0cdf5
commit 1c9136a8cd
14 changed files with 31 additions and 22 deletions
@@ -72,8 +72,8 @@ public class IterableTypesDetection(
if (!canBeIterable(type)) return null
val expression = KtPsiFactory(project).createExpression("fake")
val expressionReceiver = ExpressionReceiver(expression, type.type)
val context = ExpressionTypingContext.newContext(BindingTraceContext(), scope, DataFlowInfo.EMPTY, TypeUtils.NO_EXPECTED_TYPE)
val expressionReceiver = ExpressionReceiver.create(expression, type.type, context.trace.bindingContext)
val elementType = forLoopConventionsChecker.checkIterableConvention(expressionReceiver, context)
return elementType?.let { FuzzyType(it, type.freeParameters) }
}
@@ -44,7 +44,7 @@ fun DeclarationDescriptorWithVisibility.isVisible(
val receiver = element.getReceiverExpression()
val type = receiver?.let { bindingContext.getType(it) }
val explicitReceiver = type?.let { ExpressionReceiver(receiver!!, it) }
val explicitReceiver = type?.let { ExpressionReceiver.create(receiver!!, it, bindingContext) }
if (explicitReceiver != null) {
val normalizeReceiver = ExpressionTypingUtils.normalizeReceiverValueForVisibility(explicitReceiver, bindingContext)