* {@inheritDoc}
*/
@Override
void generateInstanceMethodDoc(ClassInstance classInstance, String methodName, ClassMethod classMethod, int index) {
InstanceMethodMetadata metadata = (InstanceMethodMetadata)getMetadata(CALFeatureName.getInstanceMethodFeatureName(classInstance, methodName), getLocale());
CALDocComment docComment = classInstance.getMethodCALDocComment(methodName);
////
/// With an instance method, we attempt to figure out which CALDoc comment to refer to for documentation.
/// Often it is the case that the instance method, or even the class instance, would be undocumented. In such situations,
/// it would be beneficial to present the documentation on the class method, since after all it is a class method that
/// ultimately ends up being used in expressions, not the instance method backing it.
//
Scope scope = null;
String unqualifiedName = methodName;
FunctionalAgent entityWithArgumentNames = classMethod;
CALDocComment classMethodCALDocComment = classMethod.getCALDocComment();
TypeExpr typeExpr = classInstance.getInstanceMethodType(methodName);
ArgumentMetadata[] argMetadataArray = metadata.getArguments();
String label = labelMaker.getLabel(classInstance, methodName);
/// If there are no @arg blocks for the instance method's CALDoc comment, or there is no CALDoc comment for the method at
/// all, use the CALDoc comment for the class method
//
final CALDocComment docCommentForArguments;
if (docComment != null && docComment.getNArgBlocks() > 0) {
docCommentForArguments = docComment;
} else {
docCommentForArguments = classMethodCALDocComment;
}
/// If there is no @return block for the instance method's CALDoc comment, or there is no CALDoc comment for the method at
/// all, use the CALDoc comment for the class method - but only if the class method's arity matches the instance method's arity.
//
final CALDocComment docCommentForReturnValue;
if (docComment != null && docComment.getReturnBlock() != null) {
docCommentForReturnValue = docComment;
} else if (classMethod.getTypeExpr().getArity() == typeExpr.getArity()) {