Skip to content
1 min read · 172 words

Function: immediateDominator()

ts
function immediateDominator(
  view: RawPlanView | PlanGraphView,
  entryId: string,
  nodeId: string,
): string | undefined;

Defined in: src/batteries/orchestration/plan.ts:326

The immediate dominator of a node, relative to an entry.

Parameters

ParameterTypeDescription
view| RawPlanView | PlanGraphViewThe graph to search.
entryIdstringThe entry node id.
nodeIdstringThe node whose immediate dominator to find.

Returns

string | undefined

The immediate dominator's id, or undefined when none exists.

Remarks

The standard iterative dominator algorithm (Cooper–Harvey–Kennedy). A node d dominates n when every path from entryId to n passes through d; the immediate dominator is the unique strict dominator closest to n. A join's FORK is its immediate dominator — which is what makes diamond joins decidable: the fork is known statically, so correlation and required are computable at freeze.

Returns undefined when nodeId is the entry itself (a node does not dominate itself in the immediate sense) or when nodeId is unreachable from entryId (no dominator exists).