( key: Key, module: SourceModule, kindOfKey: KindOfKey )
| 1681 | } |
| 1682 | |
| 1683 | private keyKindOf( |
| 1684 | key: Key, |
| 1685 | module: SourceModule, |
| 1686 | kindOfKey: KindOfKey |
| 1687 | ): KindBits { |
| 1688 | if ("args" in key) { |
| 1689 | return this.returnKindIn( |
| 1690 | key.fn, |
| 1691 | module, |
| 1692 | this.appliedKindOfKey(key, module, kindOfKey) |
| 1693 | ) |
| 1694 | } |
| 1695 | if ("type" in key) return this.returnKindIn(key, module, kindOfKey) |
| 1696 | if ("owner" in key) { |
| 1697 | return "type" in key.owner ? |
| 1698 | this.fieldKindIn(key.owner, key.name, module, kindOfKey) |
| 1699 | : this.passedMemberKindIn(key.owner, key.name, module, kindOfKey) |
| 1700 | } |
| 1701 | const binding = key |
| 1702 | switch (binding.kind) { |
| 1703 | case "import": |
| 1704 | return this.targetKindOf(this.importOf(binding, module), kindOfKey) |
| 1705 | case "param": |
| 1706 | return ( |
| 1707 | this.paramKindOf(binding, module, kindOfKey) | |
| 1708 | this.writtenKindOf(binding, module, kindOfKey) |
| 1709 | ) |
| 1710 | case "function": |
| 1711 | return ( |
| 1712 | functionKindOf( |
| 1713 | kindOfKey(binding.declaration as FunctionNode, module) |
| 1714 | ) | this.namespaceKindOf(binding, module, kindOfKey) |
| 1715 | ) |
| 1716 | case "namespace": |
| 1717 | case "enum": |
| 1718 | return kinds.data | this.namespaceKindOf(binding, module, kindOfKey) |
| 1719 | // e.g. `C` given `static T = User` or `static { this.T = User }` |
| 1720 | case "class": { |
| 1721 | let held = this.heldKindOf({ |
| 1722 | node: binding.declaration, |
| 1723 | module, |
| 1724 | kindOfKey |
| 1725 | }) |
| 1726 | for (const write of this.writesThrough(binding, module)) { |
| 1727 | if (write.type === "AssignmentExpression") |
| 1728 | held |= this.transfer(write.right, module, kindOfKey) |
| 1729 | } |
| 1730 | return ( |
| 1731 | holderOf(held) | |
| 1732 | this.storedKindOf(binding, module, kindOfKey) | |
| 1733 | this.namespaceKindOf(binding, module, kindOfKey) |
| 1734 | ) |
| 1735 | } |
| 1736 | case "const": |
| 1737 | case "let": |
| 1738 | case "var": |
| 1739 | break |
| 1740 | default: |
no test coverage detected