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

Function embedClosure

src/resolution/callback-synthesizer.ts:1143–1156  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

1141 // The type and every type it embeds, down to the last level. Go allows a
1142 // struct to embed a pointer to itself, or to one embedding it back.
1143 const embedClosure = (id: string): string[] => {
1144 if (embeds(id).length === 0) return [id];
1145 const reached = new Set<string>([id]);
1146 const pending = [id];
1147 while (pending.length > 0) {
1148 const at = pending.pop()!;
1149 for (const t of embeds(at)) {
1150 if (reached.has(t)) continue;
1151 reached.add(t);
1152 pending.push(t);
1153 }
1154 }
1155 return [...reached];
1156 };
1157
1158 // The types each one embeds from outside the index, as the resolver's failed
1159 // `extends` rows: the methods of a standard-library type or of `error`, by

Callers 5

methodNamesFunction · 0.85
methodAritiesFunction · 0.85
wantedAritiesFunction · 0.85
methodTypesFunction · 0.85
typesFitFunction · 0.85

Calls 4

embedsFunction · 0.85
hasMethod · 0.80
pushMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected