Skip to main content

parse_unit_with_warnings_from

Function parse_unit_with_warnings_from 

Source
pub fn parse_unit_with_warnings_from(
    tokens: &[Token],
    source: &str,
    next_id: &mut u32,
) -> Result<(SourceUnit, Vec<CompileError>), Vec<CompileError>>
Expand description

parse_unit_with_warnings, continuing ExprId allocation from next_id instead of starting at 0, and writing the id one past the last one this parse handed out back into it. T3.4 (R2.4): every top-level parse entry point in this file constructs its own Parser and therefore its own zero-based id space; a caller that will check two files’ output together in one pass (a multi-file commons — bynk-emit’s collect_unit_methods merges a type’s methods from sibling files into the file that declares the type, before one check_record call) must thread one counter across every file it parses, or two independently-numbered files collide on the same id in the same expr_types map. Every other caller (a single buffer, an LSP hover/completion query, a fixture test) never merges its output with another file’s before checking, so starting at 0 every time is correct — parse_unit_with_warnings above is that default, unchanged.