mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
unconditionally add the necessary properties to AST nodes (#976)
Fixes a bizarre bug that caused us to assign the wrong name to object properties, apparently because the node ID was not defined at the appropriate time.
This commit is contained in:
parent
70d13b8948
commit
01df038474
@ -505,12 +505,7 @@ Walker.prototype._recurse = function(filename, ast) {
|
|||||||
|
|
||||||
var isScope = astnode.isScope(node);
|
var isScope = astnode.isScope(node);
|
||||||
|
|
||||||
// for efficiency, if the node has a `parent` property, assume that we've already
|
|
||||||
// added the required properties
|
|
||||||
if (typeof node.parent !== 'undefined') {
|
|
||||||
astnode.addNodeProperties(node);
|
astnode.addNodeProperties(node);
|
||||||
}
|
|
||||||
|
|
||||||
node.parent = parent || null;
|
node.parent = parent || null;
|
||||||
|
|
||||||
currentScope = getCurrentScope(cbState.scopes);
|
currentScope = getCurrentScope(cbState.scopes);
|
||||||
|
|||||||
4
test/fixtures/objectkeys.js
vendored
Normal file
4
test/fixtures/objectkeys.js
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
var myObject = {
|
||||||
|
foo: 1,
|
||||||
|
bar: 2
|
||||||
|
};
|
||||||
12
test/specs/documentation/objectkeys.js
Normal file
12
test/specs/documentation/objectkeys.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe('object keys', function() {
|
||||||
|
var docSet = jasmine.getDocSetFromFile('test/fixtures/objectkeys.js');
|
||||||
|
|
||||||
|
it('should assign the correct longname and memberof to object keys after the first key', function() {
|
||||||
|
var bar = docSet.getByLongname('myObject.bar')[0];
|
||||||
|
|
||||||
|
expect(bar).toBeDefined();
|
||||||
|
expect(bar.memberof).toBe('myObject');
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user