Skip to main content

parse_sources

Function parse_sources 

Source
pub fn parse_sources(
    root: &Path,
    prefix: &Path,
    path: &Path,
    source: String,
) -> Result<(Vec<ParsedFile>, Vec<CompileError>), Vec<CompileError>>
Expand description

Parse already-read source text into a ParsedFile. The read happens at the call site (v0.24): the pipeline owns the text for snapshots and per-file error attribution, and the overlay supplies unsaved buffers. Slice 0: prefix is this tree’s project-root-relative include prefix (src, tests, …), empty for a single-root project. It builds each file’s identity_path; source_path stays relative to root (the tree), which is what unit validation reads. See ParsedFile.

P8.4 (#1515): the actual tokenize+parse now runs through crate::parse_cache::cached_parse, keyed on the file’s own absolute path — durable across separate calls to this function, not just within one, so a FileId (and the ExprIds a file’s own expressions carry) no longer resets every time a fresh analysis pass parses an unchanged file. next_expr_id/next_file_id are no longer threaded in from the caller for this reason — the cache owns both counters now, durably.