Debug: use pretty-print to dump the LLR

the Debug trait for the LLR isn't that usefull
This commit is contained in:
Olivier Goffart 2023-08-22 14:06:37 +02:00 committed by Olivier Goffart
parent f100ee48ff
commit 0345c9bc48
2 changed files with 7 additions and 7 deletions

View file

@ -90,11 +90,10 @@ pub fn generate(
)); // Perhaps byte code in the future?
}
OutputFormat::Llr => {
writeln!(
destination,
"{:#?}",
crate::llr::lower_to_item_tree::lower_to_item_tree(&doc.root_component)
)?;
let root = crate::llr::lower_to_item_tree::lower_to_item_tree(&doc.root_component);
let mut output = String::new();
crate::llr::pretty_print::pretty_print(&root, &mut output).unwrap();
write!(destination, "{output}")?;
}
}
Ok(())

View file

@ -64,9 +64,10 @@ impl<'a> PrettyPrinter<'a> {
self.indent()?;
writeln!(
self.writer,
"{}: {};",
"{}: {};{}",
DisplayPropertyRef(p, &ctx),
DisplayExpression(&init.expression.borrow(), &ctx)
DisplayExpression(&init.expression.borrow(), &ctx),
if init.is_constant { " /*const*/" } else { "" }
)?
}
for ssc in &sc.sub_components {