private void emitMethodCall(final MethodInfo method, final IArgumentProvider args, final Type<?> objectType, final int flags) {
// Emit arguments
emitArguments(method, args);
if ((flags & CompilationFlags.EmitAsSuperCall) != 0) {
final MethodInfo superMethod = objectType.getMethod(
method.getName(),
BindingFlags.AllInstance,
method.getParameters().getParameterTypes().toArray()
);
generator.call(OpCode.INVOKESPECIAL, superMethod);
}
else {
generator.call(method);
}
final Type returnType = method.getReturnType();
if (returnType != PrimitiveTypes.Void &&
(method.isGenericMethod() || method.getDeclaringType().isGenericType())) {
final MethodInfo erasedDefinition = method.getErasedMethodDefinition();
if (erasedDefinition != null) {
generator.emitConversion(
erasedDefinition.getReturnType(),
returnType);
}
}
}