} else if (resolution.getReturnedArgument() != -1) {
result = arguments.get(resolution.getReturnedArgument());
} else {
result = factory.createVariable(resultType);
factory.addStatement(new ObjectCorrupt(result));
}
// handle corrupted arguments
if (resolution.getCorruptedArguments().size() != arguments.size()) {
throw new InvalidResolutionException("Incorrect number of arguments in method resolution");
}
for (int i=0; i<arguments.size(); i++) {
if (arguments.get(i).isMutable() && resolution.isArgumentCorrupted(i)) {
factory.addStatement(new ObjectCorrupt(arguments.get(i)));
}
}
return result;
}