( binding: Binding, module: SourceModule, kindOfKey: KindOfKey )
| 1792 | |
| 1793 | // e.g. `N` given `namespace N { export const User = type(...) }`, merged across declarations |
| 1794 | private namespaceKindOf( |
| 1795 | binding: Binding, |
| 1796 | module: SourceModule, |
| 1797 | kindOfKey: KindOfKey |
| 1798 | ): KindBits { |
| 1799 | let held = 0 |
| 1800 | let isNamespace = false |
| 1801 | for (let id of [binding.id, ...binding.writes]) { |
| 1802 | while (id.parent?.type === "TSQualifiedName") id = id.parent |
| 1803 | const declaration = id.parent |
| 1804 | if (declaration?.type !== "TSModuleDeclaration") continue |
| 1805 | isNamespace = true |
| 1806 | // e.g. `T` in `namespace A.B { export const T = ... }`, read off A |
| 1807 | walk(declaration, node => { |
| 1808 | if (node.type === "ExportNamedDeclaration" && node.declaration) { |
| 1809 | for (const exported of declaredIds(node.declaration)) { |
| 1810 | const inner = module.scopes.bindingsById.get(exported) |
| 1811 | if (inner) held |= kindOfKey(inner, module) |
| 1812 | } |
| 1813 | } |
| 1814 | return node === declaration || node.type === "TSModuleBlock" |
| 1815 | }) |
| 1816 | } |
| 1817 | if (!isNamespace) return 0 |
| 1818 | for (const write of this.writesThrough(binding, module)) { |
| 1819 | if (write.type === "AssignmentExpression") |
| 1820 | held |= this.transfer(write.right, module, kindOfKey) |
| 1821 | } |
| 1822 | return holderOf(held) |
| 1823 | } |
| 1824 | |
| 1825 | // e.g. `list.push(A)`, `o.User = A` or `Object.assign(o, { A })` |
| 1826 | private storedKindOf( |
no test coverage detected