Refactoring. Change type of ResolvedCall#extensionReceiver from Receiver to ReceiverValue

This commit is contained in:
Stanislav Erokhin
2016-03-29 21:27:31 +03:00
parent 63a2d8a416
commit bf08341ee4
19 changed files with 40 additions and 53 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1219,7 +1219,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
ResolvedCall<? extends CallableDescriptor> call = CallUtilKt.getResolvedCall(expr, bindingContext);
if (call != null) {
lookupReceiver(call.getDispatchReceiver());
lookupReceiver((ReceiverValue) call.getExtensionReceiver());
lookupReceiver(call.getExtensionReceiver());
}
}
else if (descriptor instanceof VariableDescriptor) {
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -504,7 +504,7 @@ public abstract class StackValue {
callDispatchReceiver = ((SyntheticFieldDescriptor) descriptor).getDispatchReceiverForBackend();
}
ReceiverValue callExtensionReceiver = (ReceiverValue) resolvedCall.getExtensionReceiver();
ReceiverValue callExtensionReceiver = resolvedCall.getExtensionReceiver();
if (callDispatchReceiver != null || callExtensionReceiver != null
|| isLocalFunCall(callableMethod) || isCallToMemberObjectImportedByName(resolvedCall)) {
ReceiverParameterDescriptor dispatchReceiverParameter = descriptor.getDispatchReceiverParameter();
@@ -850,7 +850,7 @@ public abstract class StackValue {
v.store(firstParamIndex, type);
}
ReceiverValue receiverParameter = (ReceiverValue) resolvedGetCall.getExtensionReceiver();
ReceiverValue receiverParameter = resolvedGetCall.getExtensionReceiver();
int receiverIndex = -1;
if (receiverParameter != null) {
Type type = codegen.typeMapper.mapType(receiverParameter.getType());
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,14 +25,13 @@ import org.jetbrains.kotlin.psi.KtClassLiteralExpression
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
class KClassJavaProperty : IntrinsicPropertyGetter() {
override fun generate(resolvedCall: ResolvedCall<*>?, codegen: ExpressionCodegen, returnType: Type, receiver: StackValue): StackValue? {
val extensionReceiver = resolvedCall!!.extensionReceiver as ReceiverValue
val extensionReceiver = resolvedCall!!.extensionReceiver!!
val type = extensionReceiver.type.arguments.single().type
val asmType = codegen.state.typeMapper.mapType(type)