You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Problem
Setup code for the analyzer. The `HIR` gets wrapped with a metadata
field.
Illustration:
```rust
/// Metadata that can be attached to expression nodes
///
/// This trait allows for different types of metadata to be attached to
/// expression nodes while maintaining a common interface for access.
pub trait ExprMetadata: Debug + Clone {}
/// Empty metadata implementation for cases where no additional data is needed
pub struct NoMetadata;
/// Combined span and type information for an expression
pub struct TypedSpan {
/// Source code location.
pub span: Span,
/// Inferred type.
pub ty: Type,
}
/// Expression nodes in the HIR with optional metadata
///
/// The M type parameter allows attaching different kinds of metadata to expressions,
/// such as type information, source spans, or both.
pub struct Expr<M: ExprMetadata = NoMetadata> {
/// The actual expression node
pub kind: ExprKind<M>,
/// Optional metadata for the expression
pub metadata: M,
}
```
## Summary of changes
Adapted the engine to take EmptyMetadata (no functional changes), all
relevant code to review is in HIR.
The critical pass is that the metadata is all we should need to perform
type checking and inference.
This PR is dependent on #51
0 commit comments