mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
When a function symbol has an @constructs tag with no value, in a @lends block with a "Name#" value, the function is documented as a constructor of "Name". Closes #31.
This commit is contained in:
parent
bf21286685
commit
0341d71d4b
@ -47,9 +47,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newDoclet.alias) {
|
if (newDoclet.alias) {
|
||||||
if (newDoclet.alias === '{@this}') {
|
if (newDoclet.alias === '{@thisClass}') {
|
||||||
memberofName = this.resolveThis(e.astnode);
|
memberofName = this.resolveThis(e.astnode);
|
||||||
newDoclet.alias = memberofName;//'Blizp'
|
|
||||||
|
// "class" refers to the owner of the prototype, not the prototype itself
|
||||||
|
if ( /^(.+?)(\.prototype|#)$/.test(memberofName) ) {
|
||||||
|
memberofName = RegExp.$1;
|
||||||
|
}
|
||||||
|
newDoclet.alias = memberofName;
|
||||||
}
|
}
|
||||||
newDoclet.addTag('name', newDoclet.alias);
|
newDoclet.addTag('name', newDoclet.alias);
|
||||||
newDoclet.postProcess();
|
newDoclet.postProcess();
|
||||||
|
|||||||
@ -113,7 +113,7 @@
|
|||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
var ownerClassName;
|
var ownerClassName;
|
||||||
if (!tag.value) {
|
if (!tag.value) {
|
||||||
ownerClassName = '{@this}'; // this can be resolved later in the handlers
|
ownerClassName = '{@thisClass}'; // this can be resolved later in the handlers
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ownerClassName = firstWordOf(tag.value);
|
ownerClassName = firstWordOf(tag.value);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
var Person = Class.create(/** @lends Person */{
|
var Person = Class.create(/** @lends Person# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Describe the constructor.
|
Describe the constructor.
|
||||||
|
|||||||
@ -1,7 +1,14 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var docSet = testhelpers.getDocSetFromFile('test/cases/constructstag4.js'),
|
var docSet = testhelpers.getDocSetFromFile('test/cases/constructstag4.js'),
|
||||||
|
person = docSet.getByLongname('Person').filter(function($) {
|
||||||
|
return ! $.undocumented;
|
||||||
|
})[0],
|
||||||
personName = docSet.getByLongname('Person#name')[0];
|
personName = docSet.getByLongname('Person#name')[0];
|
||||||
|
|
||||||
|
test('When a function symbol has an @constructs tag with no value, in a @lends block with a "Name#" value, the function is documented as a constructor of "Name".', function() {
|
||||||
|
assert.equal(person.kind, 'class');
|
||||||
|
});
|
||||||
|
|
||||||
test('When a function symbol has an @constructs tag with no value, any this-variables are ducumented as instance members of the class.', function() {
|
test('When a function symbol has an @constructs tag with no value, any this-variables are ducumented as instance members of the class.', function() {
|
||||||
assert.equal(personName.memberof, 'Person');
|
assert.equal(personName.memberof, 'Person');
|
||||||
assert.equal(personName.scope, 'instance');
|
assert.equal(personName.scope, 'instance');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user