mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
treat memberof info like alias info when tracking variables (#880)
This change allows you to say, for example, that a symbol is a `memberof` a module, and the children of that symbol will automatically inherit the `memberof` info. (Previously this only worked if the symbol and its properties were defined in the module file.)
This commit is contained in:
parent
c5f93a72e9
commit
c6528bb090
@ -37,7 +37,7 @@ function getLeadingComment(node) {
|
|||||||
function makeVarsFinisher(scopeDoclet) {
|
function makeVarsFinisher(scopeDoclet) {
|
||||||
return function(e) {
|
return function(e) {
|
||||||
// no need to evaluate all things related to scopeDoclet again, just use it
|
// no need to evaluate all things related to scopeDoclet again, just use it
|
||||||
if (scopeDoclet && e.doclet && e.doclet.alias) {
|
if ( scopeDoclet && e.doclet && (e.doclet.alias || e.doclet.memberof) ) {
|
||||||
scopeDoclet.meta.vars[e.code.name] = e.doclet.longname;
|
scopeDoclet.meta.vars[e.code.name] = e.doclet.longname;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -80,4 +80,13 @@ describe('@memberof tag', function() {
|
|||||||
|
|
||||||
expect(leaf.longname, 'module:terrain.Forest#Tree#leaf');
|
expect(leaf.longname, 'module:terrain.Forest#Tree#leaf');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Properties of a symbol with a @memberof tag inherit the @memberof info.', function() {
|
||||||
|
var docSet = jasmine.getDocSetFromFile('test/fixtures/memberoftag5.js');
|
||||||
|
var open = docSet.getByLongname('module:network.Socket#open')[0];
|
||||||
|
var uid = docSet.getByLongname('module:network.Socket.uid')[0];
|
||||||
|
|
||||||
|
expect(open).toBeDefined();
|
||||||
|
expect(uid).toBeDefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user