* Resolve what function a var is limited to. * @param {astnode} node * @param {string} basename The leftmost name in the long name: in foo.bar.zip the basename is foo.
({enclosingScope, type}, basename)
| 610 | * @param {string} basename The leftmost name in the long name: in foo.bar.zip the basename is foo. |
| 611 | */ |
| 612 | resolveVar({enclosingScope, type}, basename) { |
| 613 | let doclet; |
| 614 | let result; |
| 615 | const scope = enclosingScope; |
| 616 | |
| 617 | // HACK: return an empty string for function declarations so they don't end up in anonymous |
| 618 | // scope (see #685 and #693) |
| 619 | if (type === Syntax.FunctionDeclaration) { |
| 620 | result = ''; |
| 621 | } |
| 622 | else if (!scope) { |
| 623 | result = ''; // global |
| 624 | } |
| 625 | else { |
| 626 | doclet = this._getDocletById(scope.nodeId); |
| 627 | if ( definedInScope(doclet, basename) ) { |
| 628 | result = doclet.longname; |
| 629 | } |
| 630 | else { |
| 631 | result = this.resolveVar(scope, basename); |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | return result; |
| 636 | } |
| 637 | |
| 638 | // TODO: docs |
| 639 | resolveEnum(e) { |
no test coverage detected