KT-873 fixing wrong register calculations

This commit is contained in:
Alex Tkachman
2012-01-04 14:29:21 +02:00
parent 629cdfc822
commit 3fd825d1a0
3 changed files with 16 additions and 6 deletions
@@ -256,28 +256,23 @@ public class ClosureCodegen extends ObjectOrClosureCodegen {
iv.invokespecial(funClass, "<init>", "(Ljet/TypeInfo;)V");
i = 1;
int k = 0;
for (Type type : argTypes) {
StackValue.local(0, JetTypeMapper.TYPE_OBJECT).put(JetTypeMapper.TYPE_OBJECT, iv);
StackValue.local(i, type).put(type, iv);
final String fieldName;
if (captureThis && i == 1) {
fieldName = "this$0";
i++;
k++;
}
else {
if (captureReceiver != null && (captureThis && i == 2 || !captureThis && i == 1)) {
fieldName = "receiver$0";
i++;
k++;
}
else {
VariableDescriptor removed = variableDescriptors.remove(0);
fieldName = "$" + removed.getName();
i++;
}
}
i += type.getSize();
StackValue.field(type, name, fieldName, false).store(iv);
}