(symbol, enclosingDeclaration)
| 51553 | return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent)); |
| 51554 | } |
| 51555 | function getAlternativeContainingModules(symbol, enclosingDeclaration) { |
| 51556 | var containingFile = ts.getSourceFileOfNode(enclosingDeclaration); |
| 51557 | var id = getNodeId(containingFile); |
| 51558 | var links = getSymbolLinks(symbol); |
| 51559 | var results; |
| 51560 | if (links.extendedContainersByFile && (results = links.extendedContainersByFile.get(id))) { |
| 51561 | return results; |
| 51562 | } |
| 51563 | if (containingFile && containingFile.imports) { |
| 51564 | // Try to make an import using an import already in the enclosing file, if possible |
| 51565 | for (var _i = 0, _a = containingFile.imports; _i < _a.length; _i++) { |
| 51566 | var importRef = _a[_i]; |
| 51567 | if (ts.nodeIsSynthesized(importRef)) |
| 51568 | continue; // Synthetic names can't be resolved by `resolveExternalModuleName` - they'll cause a debug assert if they error |
| 51569 | var resolvedModule = resolveExternalModuleName(enclosingDeclaration, importRef, /*ignoreErrors*/ true); |
| 51570 | if (!resolvedModule) |
| 51571 | continue; |
| 51572 | var ref = getAliasForSymbolInContainer(resolvedModule, symbol); |
| 51573 | if (!ref) |
| 51574 | continue; |
| 51575 | results = ts.append(results, resolvedModule); |
| 51576 | } |
| 51577 | if (ts.length(results)) { |
| 51578 | (links.extendedContainersByFile || (links.extendedContainersByFile = new ts.Map())).set(id, results); |
| 51579 | return results; |
| 51580 | } |
| 51581 | } |
| 51582 | if (links.extendedContainers) { |
| 51583 | return links.extendedContainers; |
| 51584 | } |
| 51585 | // No results from files already being imported by this file - expand search (expensive, but not location-specific, so cached) |
| 51586 | var otherFiles = host.getSourceFiles(); |
| 51587 | for (var _b = 0, otherFiles_1 = otherFiles; _b < otherFiles_1.length; _b++) { |
| 51588 | var file = otherFiles_1[_b]; |
| 51589 | if (!ts.isExternalModule(file)) |
| 51590 | continue; |
| 51591 | var sym = getSymbolOfNode(file); |
| 51592 | var ref = getAliasForSymbolInContainer(sym, symbol); |
| 51593 | if (!ref) |
| 51594 | continue; |
| 51595 | results = ts.append(results, sym); |
| 51596 | } |
| 51597 | return links.extendedContainers = results || ts.emptyArray; |
| 51598 | } |
| 51599 | /** |
| 51600 | * Attempts to find the symbol corresponding to the container a symbol is in - usually this |
| 51601 | * is just its' `.parent`, but for locals, this value is `undefined` |
no test coverage detected
searching dependent graphs…