diff --git a/lib/jsdoc/src/walker.js b/lib/jsdoc/src/walker.js index e2c55f1f..0dcb6b29 100644 --- a/lib/jsdoc/src/walker.js +++ b/lib/jsdoc/src/walker.js @@ -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++) { diff --git a/test/fixtures/classproperties.js b/test/fixtures/classproperties.js index ba46450b..1b732b0c 100644 --- a/test/fixtures/classproperties.js +++ b/test/fixtures/classproperties.js @@ -5,4 +5,7 @@ class A { /** Private property. */ #c = 2; + + /** Property with no value assigned to it. */ + d; } diff --git a/test/specs/documentation/classproperties.js b/test/specs/documentation/classproperties.js index 6a822ccb..7629d56d 100644 --- a/test/specs/documentation/classproperties.js +++ b/test/specs/documentation/classproperties.js @@ -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'); + }); });