Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
555 changes: 546 additions & 9 deletions baml_language/Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions baml_language/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ baml_diagnostics = { path = "crates/baml_diagnostics" }
baml_hir = { path = "crates/baml_hir" }
baml_lexer = { path = "crates/baml_lexer" }
baml_parser = { path = "crates/baml_parser" }
baml_onionskin = { path = "crates/baml_onionskin" }
baml_syntax = { path = "crates/baml_syntax" }
baml_tests = { path = "crates/baml_tests" }
baml_thir = { path = "crates/baml_thir" }
Expand Down
150 changes: 0 additions & 150 deletions baml_language/PARSER_IMPLEMENTATION_SUMMARY.md

This file was deleted.

17 changes: 17 additions & 0 deletions baml_language/crates/baml_db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pub use baml_thir;
pub use baml_workspace;
use salsa::Storage;

/// Type alias for Salsa event callbacks
pub type EventCallback = Box<dyn Fn(salsa::Event) + Send + Sync + 'static>;

/// Root database combining all compiler phases.
/// With Salsa 2022, we use the #[`salsa::db`] attribute
#[salsa::db]
Expand All @@ -41,6 +44,20 @@ impl RootDatabase {
}
}

/// Create a new database with an event callback for tracking query execution.
///
/// The callback will be invoked for various Salsa events, including:
/// - `WillExecute`: A query is about to be recomputed
/// - `DidValidateMemoizedValue`: A cached value was reused
///
/// This is useful for tracking incremental compilation behavior.
pub fn new_with_event_callback(callback: EventCallback) -> Self {
Self {
storage: Storage::new(Some(callback)),
next_file_id: Arc::new(AtomicU32::new(0)),
}
}

/// Add a file to the database.
pub fn add_file(&mut self, path: impl Into<PathBuf>, text: impl Into<String>) -> SourceFile {
let file_id = FileId::new(
Expand Down
1 change: 1 addition & 0 deletions baml_language/crates/baml_hir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ workspace = true
[dependencies]
baml_base = { workspace = true }
baml_parser = { workspace = true }
baml_syntax = { workspace = true }
baml_workspace = { workspace = true }

salsa = { workspace = true }
Loading
Loading