(context: ResolutionContext)
| 891 | * resolver settles costs a lookup (see reachesAmbientModule). |
| 892 | */ |
| 893 | export function ambientModuleDeclarations(context: ResolutionContext): ReadonlyMap<string, string> { |
| 894 | const memo = memoFor(context); |
| 895 | if (memo.declarationIds) return memo.declarationIds; |
| 896 | const ids = new Map<string, string>(); |
| 897 | for (const [file, modules] of scanned(context).byFile) { |
| 898 | for (const node of context.getNodesInFile(file)) { |
| 899 | if (!isBlockLevel(node)) continue; |
| 900 | const mod = modules.find((m) => inBlock(node, m)); |
| 901 | if (mod) ids.set(node.id, mod.specifier); |
| 902 | } |
| 903 | } |
| 904 | memo.declarationIds = ids; |
| 905 | return ids; |
| 906 | } |
| 907 | |
| 908 | /** |
| 909 | * Whether line:column of `file` lies inside a block declaring `specifier`: |
no test coverage detected