pub struct Driver { /* private fields */ }Expand description
Pipeline orchestration wrapper around ProjectDb.
Implementations§
Source§impl Driver
impl Driver
Sourcepub fn set_analysis_options(&mut self, options: AnalysisOptions)
pub fn set_analysis_options(&mut self, options: AnalysisOptions)
Set the analysis options (e.g. a registered host manifest + external
check severity) used by analyze. An input write —
dependent queries recompute on next read.
Sourcepub fn db_mut(&mut self) -> &mut ProjectDb
pub fn db_mut(&mut self) -> &mut ProjectDb
Mutably borrow the underlying database.
Salsa’s dependency tracking invalidates derived queries on input writes, so no manual cache invalidation happens here.
Sourcepub fn discover<F>(
&mut self,
entry: &str,
read_file: F,
) -> Result<(), DiscoverError>
pub fn discover<F>( &mut self, entry: &str, read_file: F, ) -> Result<(), DiscoverError>
Discover all files reachable via INCLUDEs from the entry point.
Sourcepub fn discover_native(
&mut self,
tree: &dyn SourceTree,
) -> Result<(), DiscoverError>
pub fn discover_native( &mut self, tree: &dyn SourceTree, ) -> Result<(), DiscoverError>
Discover a native .brink project: enumerate tree (sorted,
root-relative keys, scoped to tree’s own constructor-held root —
issue #1371) and load every file — no INCLUDE BFS, since native has
no INCLUDEs. tree must be constructed with the project’s source
root (RealFs::new/GitRev::new) — see native_source_root to
derive it from an entry path.
Sourcepub fn analyze(&mut self) -> &AnalysisResult
pub fn analyze(&mut self) -> &AnalysisResult
Run cross-file analysis on all files (memoized by the db’s analysis
query — an unchanged project returns the cached result).
Sourcepub fn analyze_project(&self, file_ids: &[FileId]) -> AnalysisResult
pub fn analyze_project(&self, file_ids: &[FileId]) -> AnalysisResult
Run analysis on a specific subset of files (one project). Not cached.
Module-aware and options-honoring (issue #1553): the pass runs with
the db’s own ProjectDb::module_map and registered
AnalysisOptions, so the DefinitionIds it mints key this db’s
per-def queries and the declared dialect/types/lints reach it — the
same contract analyze has. A bare
brink_analyzer::analyze/analyze_with_options here was
module-blind and dropped the options entirely, which for a native
.brink project (whose module is its path, always declared) mints a
different identity space than the db’s — see
ProjectDb::module_map’s doc.
Stem-collision diagnostics (E085) are folded in from
ProjectDb::module_map_diagnostics, scoped to file_ids, for the
same reason: the analyzer is handed the finished map and cannot
re-derive them.
Sourcepub fn analysis_inputs_for(
&self,
file_ids: &[FileId],
) -> Vec<(FileId, HirFile, SymbolManifest)>
pub fn analysis_inputs_for( &self, file_ids: &[FileId], ) -> Vec<(FileId, HirFile, SymbolManifest)>
Snapshot analysis inputs for a subset of files.
Sourcepub fn analysis_inputs(&self) -> Vec<(FileId, HirFile, SymbolManifest)>
pub fn analysis_inputs(&self) -> Vec<(FileId, HirFile, SymbolManifest)>
Snapshot all analysis inputs.
Sourcepub fn compute_projects(&self) -> Vec<(FileId, Vec<FileId>)>
pub fn compute_projects(&self) -> Vec<(FileId, Vec<FileId>)>
Compute independent projects: ink files by INCLUDE reachability,
native .brink files as one project (issue #1562). See
brink_db::ProjectDb::compute_projects.
Sourcepub fn file_ids_topo(&self, entry: FileId) -> Vec<FileId>
pub fn file_ids_topo(&self, entry: FileId) -> Vec<FileId>
Return file IDs in topological include order.
Sourcepub fn file_metadata(&self) -> Vec<(FileId, String, String)>
pub fn file_metadata(&self) -> Vec<(FileId, String, String)>
Snapshot file metadata for diagnostic publishing.
Sourcepub fn collect_diagnostics(
&self,
analysis: &AnalysisResult,
entry: Option<FileId>,
) -> DiagnosticReport
pub fn collect_diagnostics( &self, analysis: &AnalysisResult, entry: Option<FileId>, ) -> DiagnosticReport
Collect all diagnostics (lowering + analysis), apply suppressions, partition.