Remove is_tail field from Call node

The `is_tail` field on the `BoundKind::Call` node was an intermediate
representation for tail-call optimization and is no longer needed as a
distinct field. The TCO pass now embeds this information directly into
the `RuntimeMetadata` of the `ExecNode`, which is the VM's internal AST.
This simplifies the `BoundKind::Call` structure and removes redundant
information.
This commit is contained in:
Michael Schimmel
2026-02-21 22:01:03 +01:00
parent 78dff07930
commit ff1024ee49
10 changed files with 236 additions and 561 deletions
+3 -4
View File
@@ -83,7 +83,6 @@ pub enum BoundKind<T = ()> {
Call {
callee: Box<BoundNode<T>>,
args: Box<BoundNode<T>>,
is_tail: bool,
},
Block {
@@ -141,8 +140,8 @@ where T: PartialEq {
BoundKind::Lambda { params: pb, upvalues: ub, body: bb, positional_count: pcb }) => {
pa == pb && ua == ub && ba == bb && pca == pcb
}
(BoundKind::Call { callee: ca, args: aa, is_tail: ta }, BoundKind::Call { callee: cb, args: ab, is_tail: tb }) => {
ca == cb && aa == ab && ta == tb
(BoundKind::Call { callee: ca, args: aa }, BoundKind::Call { callee: cb, args: ab }) => {
ca == cb && aa == ab
}
(BoundKind::Block { exprs: ea }, BoundKind::Block { exprs: eb }) => {
ea == eb
@@ -184,7 +183,7 @@ impl<T> BoundKind<T> {
};
format!("LAMBDA({}, Captures:{})", p_str, upvalues.len())
},
BoundKind::Call { is_tail, .. } => if *is_tail { "T-CALL".to_string() } else { "CALL".to_string() },
BoundKind::Call { .. } => "CALL".to_string(),
BoundKind::Block { .. } => "BLOCK".to_string(),
BoundKind::Tuple { elements } => format!("TUPLE({})", elements.len()),
BoundKind::Record { fields } => format!("RECORD({})", fields.len()),