mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-15 00:05:02 +00:00
Update parser AST to support dbg as both a statment and expression
Make `Expr::Dbg` node specific to dbg expressions, add `Expr::DbgStmt` for dbg statements. Debug expressions don't have a continuation branch. Support formatting both kinds of `Dbg` nodes.
This commit is contained in:
parent
a16f757164
commit
43d932df3b
8 changed files with 54 additions and 20 deletions
|
@ -2170,7 +2170,8 @@ fn expr_to_pattern_help<'a>(arena: &'a Bump, expr: &Expr<'a>) -> Result<Pattern<
|
|||
| Expr::If(_, _)
|
||||
| Expr::When(_, _)
|
||||
| Expr::Expect(_, _)
|
||||
| Expr::Dbg(_, _)
|
||||
| Expr::Dbg(_)
|
||||
| Expr::DbgStmt(_, _)
|
||||
| Expr::LowLevelDbg(_, _, _)
|
||||
| Expr::MalformedClosure
|
||||
| Expr::MalformedSuffixed(..)
|
||||
|
@ -3151,7 +3152,7 @@ fn stmts_to_defs<'a>(
|
|||
|
||||
let rest = stmts_to_expr(&stmts[i + 1..], arena)?;
|
||||
|
||||
let e = Expr::Dbg(arena.alloc(condition), arena.alloc(rest));
|
||||
let e = Expr::DbgStmt(arena.alloc(condition), arena.alloc(rest));
|
||||
|
||||
let e = if sp_stmt.before.is_empty() {
|
||||
e
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue