mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Format crash
This commit is contained in:
parent
fee01166c7
commit
1011ce9fba
3 changed files with 43 additions and 1 deletions
|
@ -43,7 +43,8 @@ impl<'a> Formattable for Expr<'a> {
|
|||
| MalformedIdent(_, _)
|
||||
| MalformedClosure
|
||||
| Tag(_)
|
||||
| OpaqueRef(_) => false,
|
||||
| OpaqueRef(_)
|
||||
| Crash => false,
|
||||
|
||||
// These expressions always have newlines
|
||||
Defs(_, _) | When(_, _) => true,
|
||||
|
@ -191,6 +192,10 @@ impl<'a> Formattable for Expr<'a> {
|
|||
buf.push('_');
|
||||
buf.push_str(name);
|
||||
}
|
||||
Crash => {
|
||||
buf.indent(indent);
|
||||
buf.push_str("crash");
|
||||
}
|
||||
Apply(loc_expr, loc_args, _) => {
|
||||
buf.indent(indent);
|
||||
if apply_needs_parens && !loc_args.is_empty() {
|
||||
|
|
|
@ -666,6 +666,7 @@ impl<'a> RemoveSpaces<'a> for Expr<'a> {
|
|||
arena.alloc(a.remove_spaces(arena)),
|
||||
arena.alloc(b.remove_spaces(arena)),
|
||||
),
|
||||
Expr::Crash => Expr::Crash,
|
||||
Expr::Defs(a, b) => {
|
||||
let mut defs = a.clone();
|
||||
defs.space_before = vec![Default::default(); defs.len()];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue