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:
Jeff Williams 2015-01-19 09:39:53 -08:00
parent c5f93a72e9
commit c6528bb090
2 changed files with 10 additions and 1 deletions

View File

@ -37,7 +37,7 @@ function getLeadingComment(node) {
function makeVarsFinisher(scopeDoclet) {
return function(e) {
// 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;
}
};

View File

@ -80,4 +80,13 @@ describe('@memberof tag', function() {
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();
});
});