MCPcopy
hub / github.com/colbymchenry/codegraph / synthesizeCallbackEdges

Function synthesizeCallbackEdges

src/resolution/callback-synthesizer.ts:2675–2776  ·  view source on GitHub ↗
(queries: QueryBuilder, ctx: ResolutionContext)

Source from the content-addressed store, hash-verified

2673 * Returns the count added. Never throws into indexing — callers wrap in try/catch.
2674 */
2675export async function synthesizeCallbackEdges(queries: QueryBuilder, ctx: ResolutionContext): Promise<number> {
2676 // Each sub-pass below is a whole-graph scan, and there are ~30 of them, all
2677 // running synchronously on the indexer's main thread. Their AGGREGATE can run
2678 // for well over a minute on a large repo — long enough for the #850 liveness
2679 // watchdog to SIGKILL the process mid-index (#1091), since its heartbeat lives
2680 // on this same thread. Yield between passes so the heartbeat can fire; a pass
2681 // that itself hangs (a real wedge) never reaches the next yield, so the
2682 // watchdog still catches that. See ./cooperative-yield.
2683 const yieldToLoop = createYielder();
2684
2685 // Cross-file Go method→type `contains` edges must be synthesized AND persisted
2686 // FIRST: a method declared in a different file from its receiver type is
2687 // otherwise orphaned from the struct, and goImplementsEdges (next) derives a
2688 // struct's method set from its `contains` edges — so without this it would
2689 // under-count the interfaces a cross-file struct satisfies. (#583)
2690 const goMethodContains = goCrossFileMethodContainsEdges(queries);
2691 if (goMethodContains.length > 0) queries.insertEdges(goMethodContains);
2692 await yieldToLoop();
2693
2694 // Go implicit `implements` edges must be synthesized AND persisted next: the
2695 // interface-dispatch bridge below reads `implements` edges from the DB, and
2696 // Go has none statically. (Other languages already have static implements
2697 // edges from extraction, so they don't need this pre-pass.)
2698 const goImpl = goImplementsEdges(queries);
2699 if (goImpl.length > 0) queries.insertEdges(goImpl);
2700 await yieldToLoop();
2701
2702 const fieldEdges = await fieldChannelEdges(queries, ctx, yieldToLoop); await yieldToLoop();
2703 const closureCollEdges = await closureCollectionEdges(queries, ctx, yieldToLoop); await yieldToLoop();
2704 const emitterEdges = await eventEmitterEdges(ctx, yieldToLoop); await yieldToLoop();
2705 const renderEdges = reactRenderEdges(queries, ctx); await yieldToLoop();
2706 const jsxEdges = await reactJsxChildEdges(ctx, yieldToLoop); await yieldToLoop();
2707 const vueEdges = vueTemplateEdges(ctx); await yieldToLoop();
2708 const svelteKitEdges = svelteKitLoadEdges(ctx); await yieldToLoop();
2709 const pascalEdges = pascalFormEdges(ctx); await yieldToLoop();
2710 const flutterEdges = flutterBuildEdges(queries, ctx); await yieldToLoop();
2711 const cppEdges = cppOverrideEdges(queries); await yieldToLoop();
2712 const ifaceEdges = interfaceOverrideEdges(queries); await yieldToLoop();
2713 const kotlinExpectActual = kotlinExpectActualEdges(queries); await yieldToLoop();
2714 const goGrpcEdges = goGrpcStubImplEdges(queries); await yieldToLoop();
2715 const rnEventEdgesList = rnEventEdges(ctx); await yieldToLoop();
2716 const fabricNativeEdges = fabricNativeImplEdges(ctx); await yieldToLoop();
2717 const expoXPlatEdges = expoCrossPlatformEdges(queries); await yieldToLoop();
2718 const rnXPlatEdges = rnCrossPlatformEdges(queries); await yieldToLoop();
2719 const mybatisEdges = mybatisJavaXmlEdges(queries); await yieldToLoop();
2720 const ginEdges = ginMiddlewareChainEdges(queries, ctx); await yieldToLoop();
2721 const thunkEdges = reduxThunkEdges(queries, ctx); await yieldToLoop();
2722 const registryEdges = await objectRegistryEdges(ctx, yieldToLoop); await yieldToLoop();
2723 const rtkEdges = rtkQueryEdges(queries, ctx); await yieldToLoop();
2724 const piniaEdges = piniaStoreEdges(ctx); await yieldToLoop();
2725 const vuexEdges = vuexDispatchEdges(ctx); await yieldToLoop();
2726 const celeryEdges = celeryDispatchEdges(ctx); await yieldToLoop();
2727 const springEdges = springEventEdges(ctx); await yieldToLoop();
2728 const mediatrEdges = mediatrDispatchEdges(ctx); await yieldToLoop();
2729 const sidekiqEdges = sidekiqDispatchEdges(ctx); await yieldToLoop();
2730 const laravelEdges = laravelEventEdges(ctx); await yieldToLoop();
2731 const cFnPtrEdges = cFnPointerDispatchEdges(queries, ctx); await yieldToLoop();
2732 const goframeEdges = goframeRouteEdges(ctx); await yieldToLoop();

Callers 1

Calls 15

createYielderFunction · 0.90
cFnPointerDispatchEdgesFunction · 0.90
goframeRouteEdgesFunction · 0.90
goImplementsEdgesFunction · 0.85
fieldChannelEdgesFunction · 0.85
closureCollectionEdgesFunction · 0.85
eventEmitterEdgesFunction · 0.85
reactRenderEdgesFunction · 0.85
reactJsxChildEdgesFunction · 0.85
vueTemplateEdgesFunction · 0.85
svelteKitLoadEdgesFunction · 0.85

Tested by

no test coverage detected