mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Fixed bug that caused inner symbols with @inner tag to have the wrong path.
This commit is contained in:
parent
0ba8226e59
commit
46b1905ebc
@ -214,18 +214,24 @@
|
||||
*/
|
||||
exports.resolveInner = function(name, node, doclet) {
|
||||
var enclosing = node.getEnclosingFunction(),
|
||||
enclosingDoc = exports.docFromNode(enclosing);
|
||||
if (enclosingDoc) {
|
||||
memberof = enclosingDoc.tagValue('path');
|
||||
}
|
||||
else {
|
||||
memberof = (enclosing && enclosing.name == '')? '[[anonymous]]' : '';
|
||||
}
|
||||
if (memberof) {
|
||||
name = memberof + '~' + name;
|
||||
enclosingDoc = exports.docFromNode(enclosing),
|
||||
memberof = doclet.tagValue('memberof'), // may be empty
|
||||
path = name;
|
||||
|
||||
if (!memberof) {
|
||||
if (enclosingDoc) {
|
||||
memberof = enclosingDoc.tagValue('path');
|
||||
}
|
||||
else {
|
||||
memberof = (enclosing && enclosing.name == '')? '[[anonymous]]' : '';
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
if (memberof) {
|
||||
path = memberof + '~' + name;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -5,6 +5,7 @@ load(BASEDIR + '/test/tests/04_jsdoc_docset.js');
|
||||
load(BASEDIR + '/test/tests/05_jsdoc_doclet.js');
|
||||
load(BASEDIR + '/test/tests/06_jsdoc_tag.js');
|
||||
load(BASEDIR + '/test/tests/07_jsdoc_resolvefunc.js');
|
||||
load(BASEDIR + '/test/tests/07_jsdoc_resolvefunc_2.js');
|
||||
load(BASEDIR + '/test/tests/07_jsdoc_resolvevar.js');
|
||||
load(BASEDIR + '/test/tests/08_tag_name.js');
|
||||
load(BASEDIR + '/test/tests/09_tag_desc.js');
|
||||
|
||||
10
test/samples/jsdoc_file.js
Normal file
10
test/samples/jsdoc_file.js
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
|
||||
blah
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/** @function foo */
|
||||
13
test/samples/jsdoc_resolvefunc_2.js
Normal file
13
test/samples/jsdoc_resolvefunc_2.js
Normal file
@ -0,0 +1,13 @@
|
||||
/** @namespace */
|
||||
ns = {};
|
||||
|
||||
(function() {
|
||||
|
||||
/** @inner
|
||||
@constructor
|
||||
@memberOf ns
|
||||
*/
|
||||
function foo(s) {
|
||||
}
|
||||
|
||||
})();
|
||||
31
test/tests/07_jsdoc_resolvefunc_2.js
Normal file
31
test/tests/07_jsdoc_resolvefunc_2.js
Normal file
@ -0,0 +1,31 @@
|
||||
(function() {
|
||||
var jsdoc,
|
||||
doclets;
|
||||
|
||||
JSpec.describe('jsdoc/name:resolvefunc', function() {
|
||||
|
||||
before(function() {
|
||||
// docsets can only be created by parsers
|
||||
jsdoc = {
|
||||
tag: require('jsdoc/tag'),
|
||||
parser: require('jsdoc/parser')
|
||||
};
|
||||
jsdoc.parser.parseFiles(BASEDIR + 'test/samples/jsdoc_resolvefunc_2.js');
|
||||
doclets = jsdoc.parser.result.map(function($){ return $.toObject(); });
|
||||
});
|
||||
|
||||
describe('An inner doclet that has no @name, but does have @scope and @member tags', function() {
|
||||
it('should be given a path that includes membership in the enclosing object', function() {
|
||||
var doclet = doclets[1];
|
||||
expect(doclet).to(have_property, 'name');
|
||||
expect(doclet.name).to(eql, 'foo');
|
||||
expect(doclet).to(have_property, 'scope');
|
||||
expect(doclet.scope).to(eql, 'inner');
|
||||
expect(doclet).to(have_property, 'path');
|
||||
expect(doclet.path).to(eql, 'ns~foo');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user