Skip to main content

bound_doc_run

Function bound_doc_run 

Source
pub fn bound_doc_run<'a, T: Checker>(
    comment: &Node<'a>,
    code: &[u8],
    ancestors: Ancestors<'a, '_>,
    credit: impl FnMut(&Node<'a>),
)
Expand description

Re-exported because the LOC metric bills documentation through them — Go, Ruby and Lua runs by position, and the doc comments a bound language’s tool attaches — while the predicates beside them stay crate-private. Re-exported because the LOC metric bills documentation through them — Go, Ruby and Lua runs by position, and the doc comments a bound language’s tool attaches — while the predicates beside them stay crate-private. Re-exported because the LOC metric bills documentation through them — Go, Ruby and Lua runs by position, and the doc comments a bound language’s tool attaches — while the predicates beside them stay crate-private. Credits the doc comments a bound language’s tool attaches to the declaration after them (#1613). Called from the LOC comment arm for every comment; credit receives each attached doc comment, whose own arm has already billed its rows as cloc. A language with no [Checker::DOC_BINDING] credits nothing here.

The comments compared are one stretch: the comment siblings between two other siblings, read past those DocBinding::skips names and any parse error that is no doc target and holds none. Only the stretch’s last comment does more than one sibling step, so a stretch of k members costs O(k) steps in total, the #1446 bound: it finds the sibling the stretch ends at and, when that is an [Checker::is_doc_target], walks back once to credit what the binding keeps. A stretch that ends anywhere else — a statement, a macro call, a closing brace, the end of the file — documents nothing. Members are siblings, so one in-body test (documents_where_it_sits) answers for them all.