Expand description
Incremental project database for inkle’s ink narrative scripting language.
ProjectDb is the query-shaped project model (scripting-substrate spec
§3): file texts are salsa inputs, and every pipeline stage — parse, HIR,
include graph, symbol index, resolution, signatures, analysis, LIR,
StoryData — is a memoized tracked query with dependency tracking and
early cutoff. This crate is the only one that knows salsa exists; stage
crates (brink-syntax, brink-ir, brink-analyzer,
brink-codegen-inkb) export plain functions the queries call. The
compiler (one-shot), LSP, and IDE all use ProjectDb as their project
model.
Structs§
- Body
Types - The full inferred picture of one def’s body: params, every local
(params ∪ temps) by name, and the return type. A superset of
InferredSig—signaturesis the firewall-facing projection,bodiesis what a hover/diagnostic consumer (TM-5) wants. - Compile
Product - Outcome of the full pipeline: compiled
StoryDataor the diagnostics that prevented it. Batch compile = pull this one query (spec §5). - Effect
Atoms - The raw per-definition atoms harvested from one body walk — the inputs the
solve_scc_effectsfixpoint closes over.reads/writes/callsare the direct atoms this body emits;direct_callsare the inferable (knot/stitch) callees whose rows must be joined in transitively;creates_fn_valuesare the targets this body creates fn values for (Fork A, issue #1726 — structural, fed into the call graph alongsidedirect_calls);opaquerecords that the body performed a call through a function value whose reaching values were not all created in-project (or another effects-opaque construct), forcing the pessimal floor. - Effect
Row - A static summary of the atomic effects a definition (and everything it
transitively calls) may perform — the spec §2 “row”. Unordered sets over a
finite per-project lattice, so
joinis a monotone least-upper-bound and the per-SCC fixpoint terminates without widening. - File
Diagnostics - Per-file inputs to
partition_diagnostics. - FileId
- Opaque identifier for a source file within a multi-file project.
- InMemory
- Map-backed
SourceTree: the test and web seam. - Inference
Result - The whole-project inference result (mirrors
AnalysisResult’s shape: one pure function over already-computed inputs, callable directly or wrapped as a salsa query). - Inferred
Sig - A def’s inferred signature: positional param types (declaration order) plus a return type. The generalized, per-def result of a body’s fixpoint solve — what a caller reads (never the caller reading the callee’s body directly; that’s the firewall).
- LirProduct
- Outcome of the pipeline through LIR lowering, mirroring
brink-compiler’scompile_lirstage sequence exactly. - Project
Db - Stateful incremental project database.
- Resolved
Project - Index + resolutions, aggregated across every file’s [
resolve_query] (issue #632 / FG-3) — deliberately without diagnostics, so this struct’sPartialEqnever touches a diagnostic’s range. Neither [symbol_index_query] nor any file’s [resolve_query] readsproject.analysis_options, so anAnalysisOptionsedit that only changes diagnostics (e.g. raisingsemantic_type_checktoError) never even triggers salsa to re-run this query’s closure — not just a backdate, a full skip (pinned byfg3_dependency_edges.rs). - Sig
- Per-declaration signature summary (phase-0 stub).
Enums§
- Ty
- A type in the checker’s universe (typed-mode-spec §2).
Traits§
- Source
Tree - A source of
.brinkfiles: enumerate what exists under a root (held by the implementation since construction — see the module docs), and read any key, whether or not enumeration returned it.
Functions§
- compute_
relative_ path - Compute the relative INCLUDE target to reach
to_filefromfrom_file’s directory — the inverse ofresolve_include_path:normalize(resolve_include_path(from_file, compute_relative_path(from_file, to_file))) == to_filefor both forward and..-traversing layouts. Used when a file is renamed/moved to rewrite everyINCLUDEthat points at it (and the moved file’s own includes). - has_
recognized_ source_ extension - Whether
pathnames a file with a recognized ink (.ink) or native (.brink) source extension, compared case-insensitively — used by [project_is_all_native]’s nativity vote, and now (issue #2368) also the shared, public seambrink-lsp’s own file-watcher/workspace-scan classification (is_source_pathincrates/brink-lsp/src/backend.rs) routes through, rather than carrying its own ad-hoc, case-sensitiveext == "ink" || ext == "brink"copy — the same “shared seam, not N copies” fix #2329/PR #2357 applied inside this crate’s own query surfaces. - is_
native_ source_ path - Whether
pathnames a native (.brink) source file, compared case-insensitively — [file_language] narrowed to a boolean, and public for the same reasonhas_recognized_source_extensionis (issue #2368):brink-lspcarried two of its own ad-hoc, case-sensitiveext == "brink"copies (crates/brink-lsp/src/backend.rs’sis_native_pathandcrates/brink-lsp/src/backend/projects.rs’s function of the same name) for a classification this crate already performs correctly — a real.BRINKfile on a case-insensitive filesystem must classify identically to.brink, not silently fall through to “not native” the wayext == "brink"alone would. - partition_
diagnostics - Collect all diagnostics (lowering + analysis), apply suppressions, and
partition into
(errors, warnings). - resolve_
include_ path - Resolve an INCLUDE path relative to the including file’s directory.