mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
fix crash when multiple params have inline JSDoc comments with no JSDoc tags (#972)
This commit is contained in:
parent
3c1f04396b
commit
80c2a9a38c
@ -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
|
||||
});
|
||||
|
||||
3
test/fixtures/inlineparamcomment.js
vendored
Normal file
3
test/fixtures/inlineparamcomment.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
var ns = {
|
||||
foo: function(/** Number */ a, /** Number */ b) {}
|
||||
};
|
||||
14
test/specs/documentation/inlineparamcomment.js
Normal file
14
test/specs/documentation/inlineparamcomment.js
Normal file
@ -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();
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user