mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
prevent crash when exporting an anonymous class (#1113)
This commit is contained in:
parent
ba673ff4c1
commit
224e796428
@ -326,10 +326,11 @@ var getInfo = exports.getInfo = function(node) {
|
||||
|
||||
break;
|
||||
|
||||
// like: "class Foo {}"
|
||||
// like: "class Foo {}"
|
||||
// or "class" in: "export default class {}"
|
||||
case Syntax.ClassDeclaration:
|
||||
info.node = node;
|
||||
info.name = nodeToValue(node.id);
|
||||
info.name = node.id ? nodeToValue(node.id) : '';
|
||||
info.type = info.node.type;
|
||||
info.paramnames = [];
|
||||
|
||||
|
||||
4
test/fixtures/anonymousclass.js
vendored
Normal file
4
test/fixtures/anonymousclass.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/** @module */
|
||||
|
||||
/** Test class */
|
||||
export default class { }
|
||||
11
test/specs/documentation/anonymousclass.js
Normal file
11
test/specs/documentation/anonymousclass.js
Normal file
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
describe('anonymous class', function() {
|
||||
it('should not crash JSDoc', function() {
|
||||
function getDocs() {
|
||||
return jasmine.getDocSetFromFile('test/fixtures/anonymousclass.js');
|
||||
}
|
||||
|
||||
expect(getDocs).not.toThrow();
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user