mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
implement inc and dec for lists
This commit is contained in:
parent
4a937b5cc2
commit
f15a50d3fa
4 changed files with 199 additions and 111 deletions
|
@ -563,7 +563,21 @@ impl<'a> Expr<'a> {
|
|||
alloc.intersperse(it, alloc.space())
|
||||
}
|
||||
}
|
||||
CallByName { name, .. } => alloc.text("*magic*"),
|
||||
CallByName { name, args, .. } => {
|
||||
let doc_name = alloc.text(format!("Call {}", name));
|
||||
let doc_args = args.iter().map(|(expr, _)| expr.to_doc(alloc, true));
|
||||
|
||||
let it = std::iter::once(doc_name).chain(doc_args);
|
||||
|
||||
if parens {
|
||||
alloc
|
||||
.text("(")
|
||||
.append(alloc.intersperse(it, alloc.space()))
|
||||
.append(alloc.text(")"))
|
||||
} else {
|
||||
alloc.intersperse(it, alloc.space())
|
||||
}
|
||||
}
|
||||
_ => todo!("not yet implemented: {:?}", self),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue