Rename: ThisReceiver ---> ImplicitReceiver

This commit is contained in:
Mikhail Glukhikh
2015-11-17 12:15:17 +03:00
parent 7ba297db81
commit 59e54d1db1
24 changed files with 58 additions and 58 deletions
@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.idea.completion
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue
import org.jetbrains.kotlin.resolve.scopes.receivers.ThisReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.descriptors.VariableDescriptor
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
@@ -29,7 +29,7 @@ fun renderDataFlowValue(value: DataFlowValue): String? {
fun renderId(id: Any?): String? {
return when (id) {
is KtExpression -> id.getText()
is ThisReceiver -> "this@${id.declarationDescriptor.getName()}"
is ImplicitReceiver -> "this@${id.declarationDescriptor.getName()}"
is VariableDescriptor -> id.getName().asString()
is PackageViewDescriptor -> id.fqName.asString()
is com.intellij.openapi.util.Pair<*, *> -> renderId(id.first) + "." + renderId(id.second)
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
import org.jetbrains.kotlin.resolve.scopes.receivers.ThisReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
@@ -61,7 +61,7 @@ class SmartCastCalculator(
fun types(thisReceiverParameter: ReceiverParameterDescriptor): Collection<KotlinType> {
val type = thisReceiverParameter.type
val thisReceiver = thisReceiverParameter.value as? ThisReceiver ?: return listOf(type)
val thisReceiver = thisReceiverParameter.value as? ImplicitReceiver ?: return listOf(type)
return entityType(thisReceiver, type)
}
@@ -97,12 +97,12 @@ class SmartCastCalculator(
dataFlowValueToEntity = fun (value: DataFlowValue): Any? {
val id = value.id
when(id) {
is VariableDescriptor, is ThisReceiver -> return id
is VariableDescriptor, is ImplicitReceiver -> return id
is Pair<*, *> -> {
val first = id.first
val second = id.second
if (first !is ThisReceiver || second !is VariableDescriptor) return null
if (first !is ImplicitReceiver || second !is VariableDescriptor) return null
if (resolutionScope?.findNearestReceiverForVariable(second)?.value != first) return null
return second
}