Fixed wrong JvmMethodParameterKind for captured local function

This commit is contained in:
Mikhael Bogdanov
2013-04-25 18:30:34 +04:00
parent 666cc6e688
commit ffed25f48c
@@ -823,19 +823,20 @@ public class JetTypeMapper extends BindingTraceAware {
if (closure != null) { if (closure != null) {
for (Map.Entry<DeclarationDescriptor, EnclosedValueDescriptor> entry : closure.getCaptureVariables().entrySet()) { for (Map.Entry<DeclarationDescriptor, EnclosedValueDescriptor> entry : closure.getCaptureVariables().entrySet()) {
DeclarationDescriptor variableDescriptor = entry.getKey(); DeclarationDescriptor variableDescriptor = entry.getKey();
Type type = null;
if (variableDescriptor instanceof VariableDescriptor && !(variableDescriptor instanceof PropertyDescriptor)) { if (variableDescriptor instanceof VariableDescriptor && !(variableDescriptor instanceof PropertyDescriptor)) {
Type sharedVarType = getSharedVarType(variableDescriptor); Type sharedVarType = getSharedVarType(variableDescriptor);
if (sharedVarType == null) { if (sharedVarType == null) {
sharedVarType = mapType(((VariableDescriptor) variableDescriptor).getType()); sharedVarType = mapType(((VariableDescriptor) variableDescriptor).getType());
} }
signatureWriter.writeParameterType(JvmMethodParameterKind.SHARED_VAR); type = sharedVarType;
signatureWriter.writeAsmType(sharedVarType, false);
signatureWriter.writeParameterTypeEnd();
} }
else if (isLocalNamedFun(variableDescriptor)) { else if (isLocalNamedFun(variableDescriptor)) {
Type type = classNameForAnonymousClass(bindingContext, (FunctionDescriptor) variableDescriptor).getAsmType(); type = classNameForAnonymousClass(bindingContext, (FunctionDescriptor) variableDescriptor).getAsmType();
}
signatureWriter.writeParameterType(JvmMethodParameterKind.VALUE); if (type != null) {
signatureWriter.writeParameterType(JvmMethodParameterKind.SHARED_VAR);
signatureWriter.writeAsmType(type, false); signatureWriter.writeAsmType(type, false);
signatureWriter.writeParameterTypeEnd(); signatureWriter.writeParameterTypeEnd();
} }