one more small step of CallableMethod refactoring

This commit is contained in:
Dmitry Jemerov
2011-06-30 20:09:32 +02:00
parent ae4a6e1558
commit 81c623a156
2 changed files with 6 additions and 6 deletions
@@ -1,5 +1,6 @@
package org.jetbrains.jet.codegen; package org.jetbrains.jet.codegen;
import org.objectweb.asm.commons.InstructionAdapter;
import org.objectweb.asm.commons.Method; import org.objectweb.asm.commons.Method;
/** /**
@@ -27,4 +28,8 @@ public class CallableMethod {
public int getInvokeOpcode() { public int getInvokeOpcode() {
return invokeOpcode; return invokeOpcode;
} }
void invoke(InstructionAdapter v) {
v.visitMethodInsn(getInvokeOpcode(), getOwner(), getDescriptor().getName(), getDescriptor().getDescriptor());
}
} }
@@ -797,7 +797,7 @@ public class ExpressionCodegen extends JetVisitor {
pushMethodArguments(expression, callableMethod.getDescriptor()); pushMethodArguments(expression, callableMethod.getDescriptor());
pushTypeArguments(expression); pushTypeArguments(expression);
invokeCallableMethod(callableMethod); callableMethod.invoke(v);
methodDescriptor = callableMethod.getDescriptor(); methodDescriptor = callableMethod.getDescriptor();
} }
else { else {
@@ -830,11 +830,6 @@ public class ExpressionCodegen extends JetVisitor {
} }
} }
private void invokeCallableMethod(CallableMethod callableMethod) {
v.visitMethodInsn(callableMethod.getInvokeOpcode(), callableMethod.getOwner(),
callableMethod.getDescriptor().getName(), callableMethod.getDescriptor().getDescriptor());
}
private Method generateJavaMethodCall(JetCallExpression expression, PsiMethod psiMethod) { private Method generateJavaMethodCall(JetCallExpression expression, PsiMethod psiMethod) {
final PsiClass containingClass = psiMethod.getContainingClass(); final PsiClass containingClass = psiMethod.getContainingClass();
String owner = JetTypeMapper.jvmName(containingClass); String owner = JetTypeMapper.jvmName(containingClass);