mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
fix crash when a class property has no value (#1400)
This commit is contained in:
parent
5080ec75bc
commit
a3523abebc
@ -492,7 +492,9 @@ walkers[Syntax.Property] = function(node, parent, state, cb) {
|
||||
// move leading comments from key to property node
|
||||
moveLeadingComments(node.key, node);
|
||||
|
||||
cb(node.value, node, state);
|
||||
if (node.value) {
|
||||
cb(node.value, node, state);
|
||||
}
|
||||
|
||||
if (node.decorators) {
|
||||
for (var i = 0, l = node.decorators.length; i < l; i++) {
|
||||
|
||||
3
test/fixtures/classproperties.js
vendored
3
test/fixtures/classproperties.js
vendored
@ -5,4 +5,7 @@ class A {
|
||||
|
||||
/** Private property. */
|
||||
#c = 2;
|
||||
|
||||
/** Property with no value assigned to it. */
|
||||
d;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ describe('class properties', function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/classproperties.js');
|
||||
var b = docSet.getByLongname('A#b')[0];
|
||||
var c = docSet.getByLongname('A#c')[0];
|
||||
var d = docSet.getByLongname('A#d')[0];
|
||||
|
||||
it('should assign the correct name, memberof, and scope to class properties', function() {
|
||||
expect(b.name).toBe('b');
|
||||
@ -18,4 +19,11 @@ describe('class properties', function() {
|
||||
expect(c.scope).toBe('instance');
|
||||
expect(c.access).toBe('private');
|
||||
});
|
||||
|
||||
it('should assign the correct name, memberof, and scope to class properties with no value ' +
|
||||
'assigned', function() {
|
||||
expect(d.name).toBe('d');
|
||||
expect(d.memberof).toBe('A');
|
||||
expect(d.scope).toBe('instance');
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user