| 1675 | }; |
| 1676 | const ifaceMemo = new Map<string, Set<string>>(); |
| 1677 | const ifaceMethods = (id: string): Set<string> => { |
| 1678 | let names = ifaceMemo.get(id); |
| 1679 | if (!names) { |
| 1680 | names = new Set<string>(); |
| 1681 | const reached = new Set<string>([id]); |
| 1682 | const pending = [id]; |
| 1683 | while (pending.length > 0) { |
| 1684 | const at = pending.pop()!; |
| 1685 | for (const m of methodsOf(at)) names.add(goMethodKey(m)); |
| 1686 | for (const e of embeds(at)) { |
| 1687 | if (reached.has(e.target)) continue; |
| 1688 | reached.add(e.target); |
| 1689 | pending.push(e.target); |
| 1690 | } |
| 1691 | } |
| 1692 | ifaceMemo.set(id, names); |
| 1693 | } |
| 1694 | return names; |
| 1695 | }; |
| 1696 | const provides = (id: string, key: string): boolean => |
| 1697 | kindOf(id) === 'interface' ? ifaceMethods(id).has(key) : methodsOf(id).some((m) => goMethodKey(m) === key); |
| 1698 | |