Remove unnecessary getThisAsReceiver function from Utils.kt file
This commit is contained in:
+1
-1
@@ -366,7 +366,7 @@ class IrInterpreter(irModule: IrModuleFragment, private val declarationsMap: Map
|
|||||||
constructorCall.dispatchReceiver!!.interpret().check { return it }
|
constructorCall.dispatchReceiver!!.interpret().check { return it }
|
||||||
state.outerClass = Variable(constructorCall.symbol.owner.dispatchReceiverParameter!!.descriptor, stack.popReturnValue())
|
state.outerClass = Variable(constructorCall.symbol.owner.dispatchReceiverParameter!!.descriptor, stack.popReturnValue())
|
||||||
}
|
}
|
||||||
valueArguments.add(Variable(constructorCall.getThisAsReceiver(), state)) //used to set up fields in body
|
valueArguments.add(Variable(irClass.thisReceiver!!.descriptor, state)) //used to set up fields in body
|
||||||
return stack.newFrame(initPool = valueArguments + state.typeArguments) {
|
return stack.newFrame(initPool = valueArguments + state.typeArguments) {
|
||||||
val statements = constructorCall.getBody()!!.statements
|
val statements = constructorCall.getBody()!!.statements
|
||||||
// enum entry use IrTypeOperatorCall with IMPLICIT_COERCION_TO_UNIT as delegation call, but we need the value
|
// enum entry use IrTypeOperatorCall with IMPLICIT_COERCION_TO_UNIT as delegation call, but we need the value
|
||||||
|
|||||||
+1
-5
@@ -24,11 +24,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitClassReceiver
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitClassReceiver
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||||
|
|
||||||
// main purpose is to get receiver from constructor call
|
|
||||||
fun IrMemberAccessExpression.getThisAsReceiver(): DeclarationDescriptor {
|
|
||||||
return (this.symbol.descriptor.containingDeclaration as ClassDescriptor).thisAsReceiverParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
fun IrFunction.getDispatchReceiver(): DeclarationDescriptor? {
|
fun IrFunction.getDispatchReceiver(): DeclarationDescriptor? {
|
||||||
return (this.symbol.descriptor.containingDeclaration as? ClassDescriptor)?.thisAsReceiverParameter
|
return (this.symbol.descriptor.containingDeclaration as? ClassDescriptor)?.thisAsReceiverParameter
|
||||||
}
|
}
|
||||||
@@ -51,6 +46,7 @@ fun DeclarationDescriptor.equalTo(other: DeclarationDescriptor): Boolean {
|
|||||||
|
|
||||||
private fun WrappedReceiverParameterDescriptor.isEqualTo(other: DeclarationDescriptor): Boolean {
|
private fun WrappedReceiverParameterDescriptor.isEqualTo(other: DeclarationDescriptor): Boolean {
|
||||||
return when (val container = this.containingDeclaration) {
|
return when (val container = this.containingDeclaration) {
|
||||||
|
is ClassDescriptor -> container == other.containingDeclaration
|
||||||
is FunctionDescriptor -> container.dispatchReceiverParameter == other || container.extensionReceiverParameter == other
|
is FunctionDescriptor -> container.dispatchReceiverParameter == other || container.extensionReceiverParameter == other
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user