add src and location to dbg

This commit is contained in:
Brendan Hansknecht 2023-12-01 20:24:23 -08:00
parent 4587c4ebc5
commit 3966d63e2f
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
21 changed files with 385 additions and 119 deletions

View file

@ -302,7 +302,7 @@ pub enum Expr<'a> {
Expect(&'a Loc<Expr<'a>>, &'a Loc<Expr<'a>>),
Dbg(&'a Loc<Expr<'a>>, &'a Loc<Expr<'a>>),
// This form of debug is a desugared call to roc_dbg
LowLevelDbg(&'a Loc<Expr<'a>>, &'a Loc<Expr<'a>>),
LowLevelDbg(&'a str, &'a str, &'a Loc<Expr<'a>>, &'a Loc<Expr<'a>>),
// Application
/// To apply by name, do Apply(Var(...), ...)
@ -1537,7 +1537,7 @@ impl<'a> Malformed for Expr<'a> {
Backpassing(args, call, body) => args.iter().any(|arg| arg.is_malformed()) || call.is_malformed() || body.is_malformed(),
Expect(condition, continuation) |
Dbg(condition, continuation) => condition.is_malformed() || continuation.is_malformed(),
LowLevelDbg(condition, continuation) => condition.is_malformed() || continuation.is_malformed(),
LowLevelDbg(_, _, condition, continuation) => condition.is_malformed() || continuation.is_malformed(),
Apply(func, args, _) => func.is_malformed() || args.iter().any(|arg| arg.is_malformed()),
BinOps(firsts, last) => firsts.iter().any(|(expr, _)| expr.is_malformed()) || last.is_malformed(),
UnaryOp(expr, _) => expr.is_malformed(),

View file

@ -1933,7 +1933,7 @@ fn expr_to_pattern_help<'a>(arena: &'a Bump, expr: &Expr<'a>) -> Result<Pattern<
| Expr::When(_, _)
| Expr::Expect(_, _)
| Expr::Dbg(_, _)
| Expr::LowLevelDbg(_, _)
| Expr::LowLevelDbg(_, _, _, _)
| Expr::MalformedClosure
| Expr::PrecedenceConflict { .. }
| Expr::MultipleRecordBuilders { .. }