Module analysis

Module analysis 

Source
Expand description

Re-export of analysis utilities from the compile crate.

Useful for tooling that needs to analyze LOGOS source without performing a full build. Compile-time analysis passes for the LOGOS compilation pipeline.

This module provides static analysis that runs after parsing but before code generation. These passes detect errors that would otherwise manifest as confusing Rust borrow checker errors.

§Analysis Passes

PassModuleDescription
EscapeescapeDetects zone-local values escaping their scope
OwnershipownershipLinear type enforcement (use-after-move)
Discoverydiscover_with_importsMulti-file type discovery

§Pass Ordering

Parser Output (AST)
       │
       ▼
┌──────────────┐
│ Escape Check │ ← Catches zone violations (fast, simple)
└──────────────┘
       │
       ▼
┌─────────────────┐
│ Ownership Check │ ← Catches use-after-move (control-flow aware)
└─────────────────┘
       │
       ▼
   Code Generation

§Re-exports

This module re-exports types from logicaffeine_language::analysis for convenience, including:

Modules§

dependencies
escape
Escape analysis for zone safety.
ownership
Native ownership analysis for use-after-move detection.
policy
registry

Structs§

CapabilityDef
A capability definition: A User can publish the Document if...
Dependency
A dependency declaration found in the document’s abstract.
DiscoveryPass
Discovery pass that scans tokens before main parsing to build a TypeRegistry.
DiscoveryResult
Result of running the discovery pass
EscapeChecker
Tracks the “zone depth” of variables for escape analysis
EscapeError
Error type for escape violations
FieldDef
Field definition within a struct
OwnershipChecker
Ownership checker - tracks variable states through control flow
OwnershipError
Error type for ownership violations
PolicyRegistry
Registry for security policies defined in ## Policy blocks.
PredicateDef
A predicate definition: A User is admin if the user's role equals "admin".
TypeRegistry
VariantDef
Phase 33: Variant definition for sum types

Enums§

EscapeErrorKind
FieldType
Type reference for struct fields (avoids circular deps with ast::TypeExpr)
OwnershipErrorKind
PolicyCondition
Condition in a policy definition. Represents the predicate logic for security rules.
TypeDef
VarState
Ownership state for a variable

Functions§

discover_with_imports
Recursive discovery with module imports.
scan_dependencies
Scans the first paragraph (Abstract) of a LOGOS file for [Alias](URI) links.