Skip to main content

Module declaration

Module declaration 

Source
Expand description

The full source range of a declaration.

Neither source of truth carries it. The graph records only the identifier — one, three characters — and the parser’s declaration span stops at the name, covering pub fn one. An edit that means “replace this function” needs where the body ends, and getting that wrong writes over whatever follows.

So the end is found by matching the declaration’s opening brace, over the tokenizer rather than the raw text: a } inside a string literal or a comment is not a closing brace, and counting characters would treat it as one.

Structs§

DeclarationRange
A declaration located in one file, in byte offsets.

Functions§

body_lines
The 1-based line range the declaration named name occupies, body included.
locate
Finds the declaration named name whose signature begins on line.