getDispatchReceiver/getExtensionReceiver always return not-null value,
but in the absence of receiver this value is equal StackValue.none(), i.e.
has a size 1

The tests were passing because of the problems with the test framework:
4b9e20ab8c
This commit is contained in:
Denis Zharkov
2017-02-07 13:12:02 +03:00
parent 4b9e20ab8c
commit 81c3edfc00
2 changed files with 4 additions and 2 deletions
@@ -2945,8 +2945,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
if (isSuspensionPoint && isSafeCallOrOnStack) {
boolean bothReceivers =
receiver instanceof StackValue.CallReceiver
&& ((StackValue.CallReceiver) receiver).getDispatchReceiver() != null
&& ((StackValue.CallReceiver) receiver).getExtensionReceiver() != null;
&& ((StackValue.CallReceiver) receiver).getDispatchReceiver().type.getSort() != Type.VOID
&& ((StackValue.CallReceiver) receiver).getExtensionReceiver().type.getSort() != Type.VOID;
Type firstReceiverType =
bothReceivers
? ((StackValue.CallReceiver) receiver).getDispatchReceiver().type
@@ -1597,10 +1597,12 @@ public abstract class StackValue {
AsmUtil.dup(v, extensionReceiver.type, dispatchReceiver.type);
}
@NotNull
public StackValue getDispatchReceiver() {
return dispatchReceiver;
}
@NotNull
public StackValue getExtensionReceiver() {
return extensionReceiver;
}