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
2 changes: 1 addition & 1 deletion src/simlin-engine/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Equation text flows through these stages in order:
- **`src/variable.rs`** - Variable variants (`Stock`, `Flow`, `Aux`, `Module`), `ModuleInput`, `Table` (graphical functions). `classify_dependencies()` is the primary API for extracting dependency categories from an AST in a single walk, returning a `DepClassification` with five sets: `all` (every referenced ident), `init_referenced`, `previous_referenced`, `previous_only` (idents only inside PREVIOUS), and `init_only` (idents only inside INIT/PREVIOUS). The older single-purpose functions (`identifier_set`, `init_referenced_idents`, etc.) remain as thin wrappers. `parse_var_with_module_context` accepts a `module_idents` set so `PREVIOUS(module_var)` falls through to module expansion instead of `LoadPrev`.
- **`src/dimensions.rs`** - Dimension context and dimension matching for arrays
- **`src/model.rs`** - Model compilation stages (`ModelStage0` -> `ModelStage1` -> `ModuleStage2`), dependency resolution, topological sort. `collect_module_idents` pre-scans datamodel variables to identify which names will expand to modules (preventing incorrect `LoadPrev` compilation). `init_referenced_vars` extends the Initials runlist to include variables referenced by `INIT()` calls, ensuring their values are captured in the `initial_values` snapshot. `check_units` is gated behind `cfg(any(test, feature = "testing"))` (production unit checking uses salsa tracked functions).
- **`src/project.rs`** - `Project` struct aggregating models. `From<datamodel::Project>`, `with_ltm()`, and `with_ltm_all_links()` are all gated behind `cfg(any(test, feature = "testing"))` (monolithic construction path, retained only for tests and the AST interpreter cross-validation path); production code uses `db::compile_project_incremental` with `ltm_enabled`/`ltm_discovery_mode` on `SourceProject`.
- **`src/project.rs`** - `Project` struct aggregating models. `from_salsa(datamodel, db, source_project, cb)` builds a Project from a pre-synced salsa database (all variable parsing comes from salsa-cached results). `from_datamodel(datamodel)` is a convenience wrapper that creates a local DB and syncs. `From<datamodel::Project>`, `with_ltm()`, and `with_ltm_all_links()` are all gated behind `cfg(any(test, feature = "testing"))` (retained only for tests and the AST interpreter cross-validation path); production code uses `db::compile_project_incremental` with `ltm_enabled`/`ltm_discovery_mode` on `SourceProject`.
- **`src/results.rs`** - `Results` (variable offsets + timeseries data), `Specs` (time/integration config)
- **`src/patch.rs`** - `ModelPatch`/`ProjectPatch` for representing and applying model changes

Expand Down
4 changes: 2 additions & 2 deletions src/simlin-engine/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,11 @@ pub fn project_units_context(db: &dyn Db, project: SourceProject) -> crate::unit
Err(unit_parse_errors) => {
// Accumulate each unit definition parsing error as a
// project-level diagnostic (no model / variable).
for (_unit_name, eq_errors) in &unit_parse_errors {
for (unit_name, eq_errors) in &unit_parse_errors {
for eq_err in eq_errors {
CompilationDiagnostic(Diagnostic {
model: String::new(),
variable: None,
variable: Some(unit_name.clone()),
error: DiagnosticError::Unit(crate::common::UnitError::DefinitionError(
eq_err.clone(),
None,
Expand Down
1 change: 1 addition & 0 deletions src/simlin-engine/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ pub(crate) fn equation_is_stdlib_call(eqn: &datamodel::Equation) -> bool {
}

#[cfg(any(test, feature = "testing"))]
#[allow(dead_code)]
impl ModelStage0 {
pub fn new(
x_model: &datamodel::Model,
Expand Down
Loading