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

Function carriesDecorator

src/graph/dead-code.ts:967–973  ·  view source on GitHub ↗

* Which of `nodes` carry a decorator: their own outgoing `decorates` edge, an * unresolved `decorates` row (the only trace a decorator imported from outside * the index, like `@HostListener` or `@Cron`, leaves), or the `decorators` * list a couple of languages record on the node itself.

(cg: CodeGraph, nodes: readonly Node[])

Source from the content-addressed store, hash-verified

965 * list a couple of languages record on the node itself.
966 */
967function carriesDecorator(cg: CodeGraph, nodes: readonly Node[]): Set<string> {
968 const ids = nodes.map((node) => node.id);
969 const found = new Set(cg.getOutgoingEdgesFrom(ids, ['decorates']).map((edge) => edge.source));
970 for (const id of cg.getUnresolvedReferenceNamesFrom(ids, ['decorates']).keys()) found.add(id);
971 for (const node of nodes) if ((node.decorators?.length ?? 0) > 0) found.add(node.id);
972 return found;
973}
974
975/**
976 * Which members are hooks their framework calls by name — the ids to drop.

Callers 2

buildDeadCodeReportFunction · 0.85
byNameHookCandidatesFunction · 0.85

Calls 4

mapMethod · 0.80
getOutgoingEdgesFromMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected