Get rid of getAsmMethod

This commit is contained in:
Michael Bogdanov
2015-03-25 15:24:49 +03:00
parent 61a49f13e1
commit c1ab7f06f7
4 changed files with 11 additions and 8 deletions
@@ -95,6 +95,10 @@ public class CallableMethod implements ExtendedCallable {
return signature.getAsmMethod();
}
public Type[] getArgumentTypes() {
return signature.getAsmMethod().getArgumentTypes();
}
@Nullable
public Type getThisType() {
return thisClass;
@@ -3675,15 +3675,15 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
Callable callable = resolveToCallable(operationDescriptor, false);
Method asmMethod = resolveToCallableMethod(operationDescriptor, false, context).getAsmMethod();
Type[] argumentTypes = asmMethod.getArgumentTypes();
CallableMethod callableMethod = resolveToCallableMethod(operationDescriptor, false, context);
Type[] argumentTypes = callableMethod.getArgumentTypes();
StackValue collectionElementReceiver =
createCollectionElementReceiver(expression, receiver, array, arrayType, operationDescriptor, isGetter, resolvedGetCall, resolvedSetCall,
callable,
argumentTypes);
Type elementType = isGetter ? asmMethod.getReturnType() : ArrayUtil.getLastElement(argumentTypes);
Type elementType = isGetter ? callableMethod.getReturnType() : ArrayUtil.getLastElement(argumentTypes);
return StackValue.collectionElement(collectionElementReceiver, elementType, resolvedGetCall, resolvedSetCall, this, state);
}
}
@@ -954,7 +954,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
for (Type argType : callableMethod.getAsmMethod().getArgumentTypes()) {
for (Type argType : callableMethod.getArgumentTypes()) {
iv.load(reg, argType);
reg += argType.getSize();
}
@@ -932,11 +932,10 @@ public abstract class StackValue {
}
if (setter instanceof CallableMethod) {
CallableMethod method = (CallableMethod) setter;
Method asmMethod = method.getAsmMethod();
Type[] argumentTypes = asmMethod.getArgumentTypes();
Type[] argumentTypes = method.getArgumentTypes();
coerce(topOfStackType, argumentTypes[argumentTypes.length - 1], v);
method.invokeWithNotNullAssertion(v, state, resolvedSetCall);
Type returnType = asmMethod.getReturnType();
Type returnType = method.getReturnType();
if (returnType != Type.VOID_TYPE) {
pop(v, returnType);
}
@@ -1008,7 +1007,7 @@ public abstract class StackValue {
}
else {
getter.invokeWithoutAssertions(v);
coerce(getter.getAsmMethod().getReturnType(), type, v);
coerce(getter.getReturnType(), type, v);
}
}