Introduce NodeId for AST and synthetic slices
This commit is contained in:
+15
-14
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user