diff --git a/idea/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/idea/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index 26ca8a9d624..65702c8c8dd 100644 --- a/idea/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/idea/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -25,15 +25,13 @@ public class ExpressionCodegen extends JetVisitor { private final Stack myStack = new Stack(); private final InstructionAdapter v; - private final JetStandardLibrary stdlib; private final FrameMap myMap; private final JetTypeMapper typeMapper; private final Type returnType; private final BindingContext bindingContext; - public ExpressionCodegen(MethodVisitor v, BindingContext bindingContext, JetStandardLibrary stdlib, FrameMap myMap, - JetTypeMapper typeMapper, Type returnType) { - this.stdlib = stdlib; + public ExpressionCodegen(MethodVisitor v, BindingContext bindingContext, FrameMap myMap, JetTypeMapper typeMapper, + Type returnType) { this.myMap = myMap; this.typeMapper = typeMapper; this.returnType = returnType; @@ -171,10 +169,6 @@ public class ExpressionCodegen extends JetVisitor { v.goTo(label); } - private void unboxBoolean() { - v.invokevirtual("java/lang/Boolean", "booleanValue", "()Z"); - } - private void generateSingleBranchIf(JetExpression expression, boolean inverse) { Label endLabel = new Label(); @@ -344,18 +338,11 @@ public class ExpressionCodegen extends JetVisitor { PsiMethod method = (PsiMethod) declarationPsiElement; pushMethodArguments(expression, method); - if (method.hasModifierProperty(PsiModifier.STATIC)) { - v.visitMethodInsn(Opcodes.INVOKESTATIC, - JetTypeMapper.jvmName(method.getContainingClass()), - method.getName(), - getMethodDescriptor(method)); - } - else { - v.visitMethodInsn(Opcodes.INVOKEVIRTUAL, - JetTypeMapper.jvmName(method.getContainingClass()), - method.getName(), - getMethodDescriptor(method)); - } + final boolean isStatic = method.hasModifierProperty(PsiModifier.STATIC); + v.visitMethodInsn(isStatic ? Opcodes.INVOKESTATIC : Opcodes.INVOKEVIRTUAL, + JetTypeMapper.jvmName(method.getContainingClass()), + method.getName(), + getMethodDescriptor(method)); final Type type = psiTypeToAsm(method.getReturnType()); if (type != Type.VOID_TYPE) { myStack.push(StackValue.onStack(type)); @@ -384,17 +371,6 @@ public class ExpressionCodegen extends JetVisitor { } } - private void unbox(PsiType type) { - if (type instanceof PsiPrimitiveType) { - if (type == PsiType.INT) { - v.invokevirtual("java/lang/Integer", "intValue", "()I"); - } - else { - throw new UnsupportedOperationException("Don't know how to unbox type " + type); - } - } - } - private static String getMethodDescriptor(PsiMethod method) { Type returnType = method.isConstructor() ? Type.VOID_TYPE : psiTypeToAsm(method.getReturnType()); PsiParameter[] parameters = method.getParameterList().getParameters(); diff --git a/idea/src/org/jetbrains/jet/codegen/FunctionCodegen.java b/idea/src/org/jetbrains/jet/codegen/FunctionCodegen.java index 89433abbcb5..ce5e443093b 100644 --- a/idea/src/org/jetbrains/jet/codegen/FunctionCodegen.java +++ b/idea/src/org/jetbrains/jet/codegen/FunctionCodegen.java @@ -65,7 +65,7 @@ public class FunctionCodegen { frameMap.enter(parameter, parameterTypes[i].getSize()); } - ExpressionCodegen codegen = new ExpressionCodegen(mv, bindingContext, standardLibrary, frameMap, typeMapper, returnType); + ExpressionCodegen codegen = new ExpressionCodegen(mv, bindingContext, frameMap, typeMapper, returnType); bodyExpression.accept(codegen); generateReturn(mv, bodyExpression, codegen); mv.visitMaxs(0, 0);