feat: Add type checking to the compiler
Introduces the `TypeChecker` struct and its associated `TypeContext` for performing static type analysis on the abstract syntax tree. This change includes: - A new `type_checker.rs` module. - Integration of `TypeChecker` into the `Environment::compile` method. - Updates to `Environment` to manage global types. - Renaming `bound_nodes.rs`'s `BoundNode` to `TypedNode` to reflect its type-checked nature. - Refinements in binder and macro expansion to accommodate type information.
This commit is contained in:
@@ -80,7 +80,7 @@ pub enum BoundKind<T = ()> {
|
||||
},
|
||||
|
||||
Map {
|
||||
entries: Vec<(Node<BoundKind<T>, T>, Node<BoundKind<T>, T>)>,
|
||||
entries: Vec<MapEntry<T>>,
|
||||
},
|
||||
|
||||
/// An expanded macro call, preserving the original call for debugging and UI.
|
||||
@@ -95,6 +95,9 @@ pub enum BoundKind<T = ()> {
|
||||
Extension(Box<dyn BoundExtension<T>>),
|
||||
}
|
||||
|
||||
/// A single entry in a Map literal (Key-Value pair)
|
||||
pub type MapEntry<T> = (Node<BoundKind<T>, T>, Node<BoundKind<T>, T>);
|
||||
|
||||
/// Type alias for a node that has been bound (addresses resolved) but not yet type-checked.
|
||||
pub type BoundNode = Node<BoundKind<()>, ()>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user