Introduce NodeId for AST and synthetic slices

This commit is contained in:
Giulio Agostini
2026-06-30 14:05:46 +02:00
parent ef8abda048
commit d40fe2a550
11 changed files with 504 additions and 170 deletions
+15 -14
View File
@@ -234,6 +234,20 @@ impl PrettyPrint for Expr {
write!(f, "{}Identifier {{ name: {:?} }}", indent, name)
}
}
Expr::Assign { name, value } => {
if ctx.config.compact {
let value_str =
pretty_print_with_config(value.as_ref(), &PrettyConfig::compact());
write!(f, "{} = {}", name, value_str)
} else {
writeln!(f, "{}Assign {{", indent)?;
writeln!(f, "{}name: {:?},", ctx.child_context(false).indent(), name)?;
write!(f, "{}value: ", ctx.child_context(true).indent())?;
value.pretty_print(&ctx.child_context(true), f)?;
writeln!(f)?;
write!(f, "{}}}", indent)
}
}
Expr::Call { callee, arguments } => {
if ctx.config.compact {
write!(f, "{}", callee)
@@ -317,20 +331,7 @@ impl PrettyPrint for Stmt {
write!(f, "{}}}", indent)
}
}
Stmt::VarAssigment { name, value, .. } => {
if ctx.config.compact {
let value_str =
pretty_print_with_config(value.as_ref(), &PrettyConfig::compact());
write!(f, "{} = {};", name, value_str)
} else {
writeln!(f, "{}Assign {{", indent)?;
writeln!(f, "{}name: {:?},", ctx.child_context(false).indent(), name)?;
write!(f, "{}value: ", ctx.child_context(true).indent())?;
value.pretty_print(&ctx.child_context(true), f)?;
writeln!(f)?;
write!(f, "{}}}", indent)
}
}
Stmt::Return { expression, .. } => {
if ctx.config.compact {
let expr_str =