Skip to main content

parse_units_with_drain_check

Function parse_units_with_drain_check 

Source
pub fn parse_units_with_drain_check(
    tokens: &[Token],
    source: &str,
) -> Result<(Vec<SourceUnit>, Vec<CompileError>, bool), Vec<CompileError>>
Expand description

parse_units_with_warnings plus whether every comment’s trivia was drained into the AST (TriviaTable::is_fully_drained). Finding #66: bynk-fmt’s comment-preservation guard re-tokenized its own rendered output just to diff comment bodies against the input — wasted work in the overwhelming common case where nothing was left behind. That guard uses this drain signal, computed from the same parse it already needs for rendering, as a fast-path: true means every comment landed in the AST, so re-checking the output can be skipped outright. No other caller needs the signal, so it rides its own entry point rather than widening parse_units_with_warnings.