diff --git a/lib/jsdoc/src/visitor.js b/lib/jsdoc/src/visitor.js index c043e343..ee1230f1 100644 --- a/lib/jsdoc/src/visitor.js +++ b/lib/jsdoc/src/visitor.js @@ -85,7 +85,7 @@ function makeInlineParamsFinisher(parser) { parentDoclet.params = parentDoclet.params || []; documentedParams = parentDoclet.params; - knownParams = parentDoclet.meta.code.paramnames; + knownParams = parentDoclet.meta.code.paramnames || []; while (true) { param = documentedParams[i]; @@ -100,7 +100,7 @@ function makeInlineParamsFinisher(parser) { // splice in the param at the current index if ( !param || i === knownParams.indexOf(e.doclet.name) ) { documentedParams.splice(i, 0, { - type: e.doclet.type, + type: e.doclet.type || {}, description: '', name: e.doclet.name }); diff --git a/test/fixtures/inlineparamcomment.js b/test/fixtures/inlineparamcomment.js new file mode 100644 index 00000000..ec303b71 --- /dev/null +++ b/test/fixtures/inlineparamcomment.js @@ -0,0 +1,3 @@ +var ns = { + foo: function(/** Number */ a, /** Number */ b) {} +}; diff --git a/test/specs/documentation/inlineparamcomment.js b/test/specs/documentation/inlineparamcomment.js new file mode 100644 index 00000000..3bcc9dd1 --- /dev/null +++ b/test/specs/documentation/inlineparamcomment.js @@ -0,0 +1,14 @@ +'use strict'; + +describe('inline comments on function parameters', function() { + var docSet; + + it('should not crash when multiple parameters have inline comments that do not contain any' + + 'JSDoc tags', function() { + function loadDocSet() { + docSet = jasmine.getDocSetFromFile('test/fixtures/inlineparamcomment.js'); + } + + expect(loadDocSet).not.toThrow(); + }); +});