mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
clarify logic for resolving property parents
This commit is contained in:
parent
79a3be132c
commit
2b34c5167a
@ -444,28 +444,28 @@ Parser.prototype.resolveThis = function(node) {
|
||||
* an empty array if no doclets are found.
|
||||
*/
|
||||
Parser.prototype.resolvePropertyParents = function(node) {
|
||||
var currentNode = node;
|
||||
var currentAncestor = node.parent;
|
||||
var nextAncestor = currentAncestor ? currentAncestor.parent : null;
|
||||
var doclet;
|
||||
var doclets = [];
|
||||
|
||||
do {
|
||||
if (currentNode.parent) {
|
||||
doclet = this._getDoclet(currentNode.parent.nodeId);
|
||||
while (currentAncestor) {
|
||||
doclet = this._getDoclet(currentAncestor.nodeId);
|
||||
if (doclet) {
|
||||
doclets.push(doclet);
|
||||
}
|
||||
|
||||
// if the parent is an assignment expression (for example, `exports.FOO` in
|
||||
// if the next ancestor's parent is an assignment expression (for example, `exports.FOO` in
|
||||
// `var foo = exports.FOO = { x: 1 }`, keep walking upwards
|
||||
if (currentNode.parent.parent.type === Syntax.AssignmentExpression) {
|
||||
currentNode = currentNode.parent;
|
||||
if (nextAncestor && nextAncestor.type === Syntax.AssignmentExpression) {
|
||||
nextAncestor = nextAncestor.parent;
|
||||
currentAncestor = currentAncestor.parent;
|
||||
}
|
||||
// otherwise, we're done
|
||||
else {
|
||||
currentNode = null;
|
||||
currentAncestor = null;
|
||||
}
|
||||
}
|
||||
} while (currentNode);
|
||||
|
||||
return doclets;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user