add and test support for return comment
This commit is contained in:
		@@ -176,6 +176,11 @@ function _genMethodDoc(
 | 
				
			|||||||
            ? { name: '', typeDocType: TypeDocTypes.Intrinsic }
 | 
					            ? { name: '', typeDocType: TypeDocTypes.Intrinsic }
 | 
				
			||||||
            : _genMethodReturnTypeDoc(abiDefinition.outputs, methodSignature, devdocIfExists);
 | 
					            : _genMethodReturnTypeDoc(abiDefinition.outputs, methodSignature, devdocIfExists);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const returnComment =
 | 
				
			||||||
 | 
					        _.isUndefined(devdocIfExists) || _.isUndefined(devdocIfExists.methods[methodSignature])
 | 
				
			||||||
 | 
					            ? undefined
 | 
				
			||||||
 | 
					            : devdocIfExists.methods[methodSignature].return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const isConstant = abiDefinition.type === 'fallback' ? true : abiDefinition.constant;
 | 
					    const isConstant = abiDefinition.type === 'fallback' ? true : abiDefinition.constant;
 | 
				
			||||||
    // TODO: determine whether fallback functions are always constant, as coded just above
 | 
					    // TODO: determine whether fallback functions are always constant, as coded just above
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -185,6 +190,7 @@ function _genMethodDoc(
 | 
				
			|||||||
        callPath: '', // TODO: wtf is this?
 | 
					        callPath: '', // TODO: wtf is this?
 | 
				
			||||||
        parameters,
 | 
					        parameters,
 | 
				
			||||||
        returnType,
 | 
					        returnType,
 | 
				
			||||||
 | 
					        returnComment,
 | 
				
			||||||
        isConstant,
 | 
					        isConstant,
 | 
				
			||||||
        isPayable: abiDefinition.payable,
 | 
					        isPayable: abiDefinition.payable,
 | 
				
			||||||
        comment,
 | 
					        comment,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,6 +84,9 @@ describe('#SolidityDocGenerator', () => {
 | 
				
			|||||||
            it('return type name', () => {
 | 
					            it('return type name', () => {
 | 
				
			||||||
                expect(methodDoc.returnType.name).to.equal('r');
 | 
					                expect(methodDoc.returnType.name).to.equal('r');
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					            it('return comment', () => {
 | 
				
			||||||
 | 
					                expect(methodDoc.returnComment).to.equal('publicMethod @return');
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        describe('should emit external method documentation for', () => {
 | 
					        describe('should emit external method documentation for', () => {
 | 
				
			||||||
            let methodDoc: SolidityMethod;
 | 
					            let methodDoc: SolidityMethod;
 | 
				
			||||||
@@ -111,6 +114,9 @@ describe('#SolidityDocGenerator', () => {
 | 
				
			|||||||
            it('return type name', () => {
 | 
					            it('return type name', () => {
 | 
				
			||||||
                expect(methodDoc.returnType.name).to.equal('r');
 | 
					                expect(methodDoc.returnType.name).to.equal('r');
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					            it('return comment', () => {
 | 
				
			||||||
 | 
					                expect(methodDoc.returnComment).to.equal('externalMethod @return');
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should not truncate a multi-line devdoc comment', () => {
 | 
					        it('should not truncate a multi-line devdoc comment', () => {
 | 
				
			||||||
            // tslint:disable-next-line:no-unnecessary-type-assertion
 | 
					            // tslint:disable-next-line:no-unnecessary-type-assertion
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user