KT-935 resolved call used on +=

This commit is contained in:
Alex Tkachman
2012-01-10 21:14:22 +02:00
parent 2e0b1863cd
commit c318191f5d
3 changed files with 46 additions and 1 deletions
@@ -1864,12 +1864,23 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
}
private void callAugAssignMethod(JetBinaryExpression expression, CallableMethod callable, Type lhsType, final boolean keepReturnValue) {
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
assert resolvedCall != null;
StackValue value = gen(expression.getLeft());
if (keepReturnValue) {
value.dupReceiver(v);
}
value.put(lhsType, v);
genToJVMStack(expression.getRight());
StackValue receiver = StackValue.onStack(lhsType);
if(!(resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor)) { // otherwise already
receiver = StackValue.receiver(resolvedCall, receiver, this, callable);
receiver.put(receiver.type, v);
}
pushTypeArguments(resolvedCall);
pushMethodArguments(resolvedCall, callable.getValueParameterTypes());
callable.invoke(v);
if (keepReturnValue) {
value.store(v);