diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java index 297b1354424..ff546c6a750 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java @@ -34,7 +34,6 @@ import org.jetbrains.jet.codegen.signature.kotlin.JetMethodAnnotationWriter; import org.jetbrains.jet.codegen.signature.kotlin.JetValueParameterAnnotationWriter; import org.jetbrains.jet.codegen.state.GenerationState; import org.jetbrains.jet.codegen.state.GenerationStateAware; -import org.jetbrains.jet.codegen.state.JetTypeMapper; import org.jetbrains.jet.codegen.state.JetTypeMapperMode; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.psi.JetNamedFunction; @@ -123,12 +122,7 @@ public class FunctionCodegen extends GenerationStateAware { return; } - MethodInfo info = generateMethodBody(mv, functionDescriptor, context, jvmSignature, strategy); - - info.localVariableNames.addAll(getParameterNamesAsStrings(functionDescriptor)); - - Type thisType = getThisTypeForFunction(functionDescriptor, context); - generateLocalVariableTable(typeMapper, mv, functionDescriptor, thisType, info); + generateMethodBody(mv, functionDescriptor, context, jvmSignature, strategy); endVisit(mv, null, origin); @@ -149,15 +143,15 @@ public class FunctionCodegen extends GenerationStateAware { } } - @NotNull - private MethodInfo generateMethodBody( + private void generateMethodBody( @NotNull MethodVisitor mv, @NotNull FunctionDescriptor functionDescriptor, @NotNull MethodContext context, @NotNull JvmMethodSignature signature, @NotNull FunctionGenerationStrategy strategy ) { - Collection localVariableNames = new ArrayList(); + Collection localVariableNames = new HashSet(getParameterNamesAsStrings(functionDescriptor)); + Map labelsForSharedVars = new HashMap(); mv.visitCode(); @@ -186,26 +180,8 @@ public class FunctionCodegen extends GenerationStateAware { Label methodEnd = new Label(); mv.visitLabel(methodEnd); - return new MethodInfo(methodBegin, methodEnd, localVariableNames, labelsForSharedVars); - } - - public static class MethodInfo { - public final Label beginLabel; - public final Label endLabel; - public final Collection localVariableNames; - public final Map labelsForSharedVars; - - public MethodInfo( - @NotNull Label beginLabel, - @NotNull Label endLabel, - @NotNull Collection localVariableNames, - @NotNull Map labelsForSharedVars - ) { - this.beginLabel = beginLabel; - this.endLabel = endLabel; - this.localVariableNames = localVariableNames; - this.labelsForSharedVars = labelsForSharedVars; - } + Type thisType = getThisTypeForFunction(functionDescriptor, context); + generateLocalVariableTable(mv, functionDescriptor, thisType, methodBegin, methodEnd, localVariableNames, labelsForSharedVars); } @NotNull @@ -218,20 +194,17 @@ public class FunctionCodegen extends GenerationStateAware { return result; } - private static void generateLocalVariableTable( - @NotNull JetTypeMapper typeMapper, + private void generateLocalVariableTable( @NotNull MethodVisitor mv, @NotNull FunctionDescriptor functionDescriptor, @Nullable Type thisType, - @NotNull MethodInfo methodInfo + @NotNull Label methodBegin, + @NotNull Label methodEnd, + @NotNull Collection localVariableNames, + @NotNull Map labelsForSharedVars ) { // TODO: specify signatures - Label methodBegin = methodInfo.beginLabel; - Label methodEnd = methodInfo.endLabel; - - Collection localVariableNames = new ArrayList(methodInfo.localVariableNames); - int k = 0; if (thisType != null) { @@ -248,7 +221,7 @@ public class FunctionCodegen extends GenerationStateAware { for (ValueParameterDescriptor parameter : functionDescriptor.getValueParameters()) { Type type = typeMapper.mapType(parameter); - Label divideLabel = methodInfo.labelsForSharedVars.get(parameter.getName()); + Label divideLabel = labelsForSharedVars.get(parameter.getName()); String parameterName = parameter.getName().getName(); if (divideLabel != null) { mv.visitLocalVariable(parameterName, type.getDescriptor(), null, methodBegin, divideLabel, k);