Skip to main content

file_representatives

Function file_representatives 

Source
pub fn file_representatives(
    fragments: &[Fragment],
) -> FxHashMap<String, FragmentId>
Expand description

One representative fragment per file — the largest by token count, ties resolved by first-seen order. This is the semantics SiblingEdgeBuilder always used for its file-level edges; file-level relations (an include, a header/impl pair, a path reference) link representatives rather than every-fragment-to-every-fragment, because the relation names the file. A change endorsing a file diffusely must not outweigh a call edge naming one symbol — the fragment-pair encoding gave both the same weight, which is simultaneously the quadratic edge blow-up (envoy: 22M c-family edges) and the file-level noise mechanism of #65. The file’s other fragments are reachable only through nesting and naming edges — the intra-file star is OFF by default and measured net-negative on the corpus (#208) — an accepted trade: a file-level relation endorses the file, not each of its siblings.