logicaffeine_compile/analysis/mod.rs
1//! Compile-time analysis passes for the LOGOS compilation pipeline.
2//!
3//! This module provides static analysis that runs after parsing but before
4//! code generation. These passes detect errors that would otherwise manifest
5//! as confusing Rust borrow checker errors.
6//!
7//! # Analysis Passes
8//!
9//! | Pass | Module | Description |
10//! |------|--------|-------------|
11//! | Escape | [`escape`] | Detects zone-local values escaping their scope |
12//! | Ownership | [`ownership`] | Linear type enforcement (use-after-move) |
13//! | Discovery | [`discover_with_imports`] | Multi-file type discovery |
14//!
15//! # Pass Ordering
16//!
17//! ```text
18//! Parser Output (AST)
19//! │
20//! ▼
21//! ┌──────────────┐
22//! │ Escape Check │ ← Catches zone violations (fast, simple)
23//! └──────────────┘
24//! │
25//! ▼
26//! ┌─────────────────┐
27//! │ Ownership Check │ ← Catches use-after-move (control-flow aware)
28//! └─────────────────┘
29//! │
30//! ▼
31//! Code Generation
32//! ```
33//!
34//! # Re-exports
35//!
36//! This module re-exports types from `logicaffeine_language::analysis` for
37//! convenience, including:
38//! - [`TypeRegistry`], [`TypeDef`], [`FieldDef`] - Type definitions
39//! - [`PolicyRegistry`], [`PredicateDef`], [`CapabilityDef`] - Security policies
40//! - [`DiscoveryPass`] - Token-level type discovery
41
42pub mod escape;
43pub mod ownership;
44mod discovery;
45
46pub use escape::{EscapeChecker, EscapeError, EscapeErrorKind};
47pub use ownership::{OwnershipChecker, OwnershipError, OwnershipErrorKind, VarState};
48pub use discovery::discover_with_imports;
49
50// Re-export language analysis types with submodule aliases
51pub mod registry {
52 pub use logicaffeine_language::analysis::registry::*;
53}
54
55pub mod policy {
56 pub use logicaffeine_language::analysis::policy::*;
57}
58
59pub mod dependencies {
60 pub use logicaffeine_language::analysis::dependencies::*;
61}
62
63pub use logicaffeine_language::analysis::{
64 TypeRegistry, TypeDef, FieldDef, FieldType, VariantDef,
65 DiscoveryPass, DiscoveryResult,
66 PolicyRegistry, PredicateDef, CapabilityDef, PolicyCondition,
67 scan_dependencies, Dependency,
68};