( binding: Binding | undefined )
| 412 | const result = new Map<string, Creation[]>() |
| 413 | const declaredIn = new Map(units.map(unit => [unit.specifier, unit])) |
| 414 | const originOf = ( |
| 415 | binding: Binding | undefined |
| 416 | ): [specifier: string, name: string] | undefined => { |
| 417 | if (binding?.kind !== "import") return |
| 418 | const specifier = binding.declaration |
| 419 | if ( |
| 420 | specifier.type !== "ImportSpecifier" || |
| 421 | specifier.parent?.type !== "ImportDeclaration" |
| 422 | ) |
| 423 | return |
| 424 | const source = specifier.parent.source.value |
| 425 | const target = parsed.get(source) |
| 426 | const entry = target?.scopes.exportsByName[exportNameOf(specifier.imported)] |
| 427 | if (entry?.kind !== "binding") return |
| 428 | return entry.binding.kind === "import" ? |
| 429 | originOf(entry.binding) |
| 430 | : [source, entry.binding.name] |
| 431 | } |
| 432 | const callsOf = new Map<string, number>() |
| 433 | for (const module of parsed.values()) { |
| 434 | for (const binding of Object.values(module.scopes.root.bindings)) { |
no test coverage detected