add basic Dbg desugaring and LowLevelDbg

This commit is contained in:
Brendan Hansknecht 2023-11-28 18:10:36 -08:00
parent 3f276b6018
commit b7f72eff86
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
12 changed files with 84 additions and 30 deletions

View file

@ -62,6 +62,9 @@ impl<'a> Formattable for Expr<'a> {
condition.is_multiline() || continuation.is_multiline()
}
Dbg(condition, continuation) => condition.is_multiline() || continuation.is_multiline(),
LowLevelDbg(condition, continuation) => {
condition.is_multiline() || continuation.is_multiline()
}
If(branches, final_else) => {
final_else.is_multiline()
@ -435,6 +438,9 @@ impl<'a> Formattable for Expr<'a> {
Dbg(condition, continuation) => {
fmt_dbg(buf, condition, continuation, self.is_multiline(), indent);
}
LowLevelDbg(_, _) => unreachable!(
"LowLevelDbg should only exist after desugaring, not during formatting"
),
If(branches, final_else) => {
fmt_if(buf, branches, final_else, self.is_multiline(), indent);
}

View file

@ -726,6 +726,10 @@ impl<'a> RemoveSpaces<'a> for Expr<'a> {
arena.alloc(a.remove_spaces(arena)),
arena.alloc(b.remove_spaces(arena)),
),
Expr::LowLevelDbg(a, b) => Expr::LowLevelDbg(
arena.alloc(a.remove_spaces(arena)),
arena.alloc(b.remove_spaces(arena)),
),
Expr::Apply(a, b, c) => Expr::Apply(
arena.alloc(a.remove_spaces(arena)),
b.remove_spaces(arena),