mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Create Expr::to_pretty in mono IR
This commit is contained in:
parent
079a8311ec
commit
c2a2ff2957
2 changed files with 13 additions and 0 deletions
|
@ -1595,6 +1595,17 @@ impl<'a> Expr<'a> {
|
|||
.append(symbol_to_doc(alloc, *structure)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_pretty(&self, width: usize) -> String {
|
||||
let allocator = BoxAllocator;
|
||||
let mut w = std::vec::Vec::new();
|
||||
self.to_doc::<_, ()>(&allocator)
|
||||
.1
|
||||
.render(width, &mut w)
|
||||
.unwrap();
|
||||
w.push(b'\n');
|
||||
String::from_utf8(w).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Stmt<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue