MCPcopy Index your code
hub / github.com/jsdoc/jsdoc / resolveVar

Method resolveVar

lib/jsdoc/src/parser.js:612–636  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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) {

Callers 1

makeSymbolFoundEventFunction · 0.80

Calls 2

_getDocletByIdMethod · 0.95
definedInScopeFunction · 0.85

Tested by

no test coverage detected