MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / declaresSwiftType

Function declaresSwiftType

src/ui-server/api/steps.ts:550–566  ·  view source on GitHub ↗
(callee: string)

Source from the content-addressed store, hash-verified

548 // nothing, so it does not count.
549 const projectTypes = new Map<string, boolean>();
550 const declaresSwiftType = async (callee: string): Promise<boolean> => {
551 const root = callee.replace(/^(?:self|Self)\./, '').split(/[.(:<]/)[0] ?? '';
552 if (!/^[A-Z]\w*$/.test(root)) return false;
553 let known = projectTypes.get(root);
554 if (known === undefined) {
555 known = false;
556 for (const n of cg.getNodesByName(root)) {
557 if (n.language !== 'swift' || !['class', 'struct', 'enum', 'interface', 'protocol'].includes(n.kind)) continue;
558 if (!(await reader.swiftExtension(n))) {
559 known = true;
560 break;
561 }
562 }
563 projectTypes.set(root, known);
564 }
565 return known;
566 };
567 const resolveByReceiver = async (caller: Node, callee: string): Promise<Node | null> => {
568 const segments = callee.replace(/\([^()]*\)/g, '').split(/[.:]+/).filter(Boolean);
569 if (segments.length < 2) return null;

Callers 1

effectLinkFunction · 0.85

Calls 4

swiftExtensionMethod · 0.80
getMethod · 0.65
getNodesByNameMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected