* Given an AST node representing an object property, find the doclets for the parent object or * objects. * * If the object is part of a simple assignment (for example, `var foo = { x: 1 }`), this method * returns a single doclet (in this case, the doclet for `foo`). *
({parent})
| 577 | * an empty array if no doclets are found. |
| 578 | */ |
| 579 | resolvePropertyParents({parent}) { |
| 580 | let currentAncestor = parent; |
| 581 | let nextAncestor = currentAncestor.parent; |
| 582 | let doclet; |
| 583 | const doclets = []; |
| 584 | |
| 585 | while (currentAncestor) { |
| 586 | doclet = this._getDocletById(currentAncestor.nodeId); |
| 587 | if (doclet) { |
| 588 | doclets.push(doclet); |
| 589 | } |
| 590 | |
| 591 | // if the next ancestor is an assignment expression (for example, `exports.FOO` in |
| 592 | // `var foo = exports.FOO = { x: 1 }`, keep walking upwards |
| 593 | if (nextAncestor && nextAncestor.type === Syntax.AssignmentExpression) { |
| 594 | nextAncestor = nextAncestor.parent; |
| 595 | currentAncestor = currentAncestor.parent; |
| 596 | } |
| 597 | // otherwise, we're done |
| 598 | else { |
| 599 | currentAncestor = null; |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | return doclets; |
| 604 | } |
| 605 | |
| 606 | // TODO: docs |
| 607 | /** |
no test coverage detected