Refactor bound node types for clarity

Introduce generic `CompilerPhase` trait to unify different stages of the
bound AST. Rename `LocalSlot` to `VirtualId` and introduce `StackOffset`
for clearer distinction between compile-time and run-time addressing.
Update type aliases and implementations to reflect these changes.
This commit is contained in:
Michael Schimmel
2026-03-13 19:20:44 +01:00
parent d035da9d91
commit e5d82ee2b6
15 changed files with 403 additions and 458 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
use crate::ast::compiler::bound_nodes::{
Address, AnalyzedNode, BoundKind, GlobalIdx, NodeMetrics, TypedNode,
Address, AnalyzedNode, BoundKind, GlobalIdx, Node, NodeMetrics, TypedNode, TypedPhase,
};
use crate::ast::types::Purity;
use std::collections::{HashMap, HashSet};
@@ -318,7 +318,7 @@ impl<'a> Analyzer<'a> {
BoundKind::Error => (BoundKind::Error, Purity::Impure),
};
crate::ast::compiler::bound_nodes::Node {
Node {
identity: node.identity.clone(),
kind: new_kind,
ty: NodeMetrics {
@@ -334,7 +334,7 @@ trait NodeExt {
fn for_each_child<F: FnMut(&TypedNode)>(&self, f: F);
}
impl NodeExt for BoundKind<crate::ast::types::StaticType> {
impl NodeExt for BoundKind<TypedPhase> {
fn for_each_child<F: FnMut(&TypedNode)>(&self, mut f: F) {
match self {
BoundKind::If {