| 1611 | }; |
| 1612 | const ifaceMemo = new Map<string, Set<string>>(); |
| 1613 | const ifaceMethods = (id: string): Set<string> => { |
| 1614 | let names = ifaceMemo.get(id); |
| 1615 | if (!names) { |
| 1616 | names = new Set<string>(); |
| 1617 | const reached = new Set<string>([id]); |
| 1618 | const pending = [id]; |
| 1619 | while (pending.length > 0) { |
| 1620 | const at = pending.pop()!; |
| 1621 | for (const m of methodsOf(at)) names.add(goMethodKey(m)); |
| 1622 | for (const e of embeds(at)) { |
| 1623 | if (reached.has(e.target)) continue; |
| 1624 | reached.add(e.target); |
| 1625 | pending.push(e.target); |
| 1626 | } |
| 1627 | } |
| 1628 | ifaceMemo.set(id, names); |
| 1629 | } |
| 1630 | return names; |
| 1631 | }; |
| 1632 | const provides = (id: string, key: string): boolean => |
| 1633 | kindOf(id) === 'interface' ? ifaceMethods(id).has(key) : methodsOf(id).some((m) => goMethodKey(m) === key); |
| 1634 | |