Support operatorAssign expressions in inline

This commit is contained in:
Mikhael Bogdanov
2014-02-21 12:49:55 +04:00
parent 4d8898c9f2
commit 2d9674089c
@@ -3007,9 +3007,13 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
private void callAugAssignMethod(JetBinaryExpression expression, CallableMethod callable, Type lhsType, boolean keepReturnValue) {
JetSimpleNameExpression reference = expression.getOperationReference();
ResolvedCall<? extends CallableDescriptor> resolvedCall =
bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
assert resolvedCall != null;
bindingContext.get(BindingContext.RESOLVED_CALL, reference);
Call call = bindingContext.get(BindingContext.CALL, reference);
assert resolvedCall != null : "Resolved call should be not null for operation reference in " + expression.getText();
assert call != null : "Call should be not null for operation reference in " + expression.getText();
StackValue value = gen(expression.getLeft());
if (keepReturnValue) {
@@ -3018,12 +3022,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
value.put(lhsType, v);
StackValue receiver = StackValue.onStack(lhsType);
if (!(resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor)) { // otherwise already
receiver = StackValue.receiver(resolvedCall, receiver, this, callable);
receiver.put(receiver.type, v);
}
pushArgumentsAndInvoke(resolvedCall, callable, CallGenerator.NOT_INLINE);
invokeMethodWithArguments(call, callable, resolvedCall, receiver);
if (keepReturnValue) {
value.store(callable.getReturnType(), v);