mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Preserve info about whether a given dbg stmt was pnc or not, at least for now
This commit is contained in:
parent
1bb9f7f530
commit
13a70c060d
18 changed files with 95 additions and 10 deletions
|
@ -527,6 +527,7 @@ pub enum Expr<'a> {
|
|||
first: &'a Loc<Expr<'a>>,
|
||||
extra_args: &'a [&'a Loc<Expr<'a>>],
|
||||
continuation: &'a Loc<Expr<'a>>,
|
||||
pnc_style: bool,
|
||||
},
|
||||
|
||||
/// The `try` keyword that performs early return on errors
|
||||
|
@ -829,6 +830,7 @@ impl<'a, 'b> RecursiveValueDefIter<'a, 'b> {
|
|||
first,
|
||||
extra_args,
|
||||
continuation,
|
||||
pnc_style: _,
|
||||
} => {
|
||||
expr_stack.reserve(2);
|
||||
expr_stack.push(&first.value);
|
||||
|
@ -2414,7 +2416,7 @@ impl<'a> Malformed for Expr<'a> {
|
|||
Closure(args, body) => args.iter().any(|arg| arg.is_malformed()) || body.is_malformed(),
|
||||
Defs(defs, body) => defs.is_malformed() || body.is_malformed(),
|
||||
Dbg => false,
|
||||
DbgStmt { first, extra_args, continuation } => first.is_malformed() || extra_args.iter().any(|a| a.is_malformed()) || continuation.is_malformed(),
|
||||
DbgStmt { first, extra_args, continuation, pnc_style: _ } => first.is_malformed() || extra_args.iter().any(|a| a.is_malformed()) || continuation.is_malformed(),
|
||||
LowLevelDbg(_, condition, continuation) => condition.is_malformed() || continuation.is_malformed(),
|
||||
Try => false,
|
||||
LowLevelTry(loc_expr, _) => loc_expr.is_malformed(),
|
||||
|
|
|
@ -3148,6 +3148,7 @@ fn stmts_to_defs<'a>(
|
|||
first,
|
||||
extra_args,
|
||||
continuation: arena.alloc(rest),
|
||||
pnc_style: false,
|
||||
};
|
||||
|
||||
let e = if sp_stmt.before.is_empty() {
|
||||
|
@ -3181,6 +3182,7 @@ fn stmts_to_defs<'a>(
|
|||
first,
|
||||
extra_args,
|
||||
continuation: arena.alloc(rest),
|
||||
pnc_style: true,
|
||||
};
|
||||
|
||||
let e = if sp_stmt.before.is_empty() {
|
||||
|
@ -3284,6 +3286,7 @@ fn stmts_to_defs<'a>(
|
|||
first: arena.alloc(condition),
|
||||
extra_args: &[],
|
||||
continuation: arena.alloc(rest),
|
||||
pnc_style: false,
|
||||
}
|
||||
} else {
|
||||
Expr::Apply(
|
||||
|
|
|
@ -718,10 +718,12 @@ impl<'a> Normalize<'a> for Expr<'a> {
|
|||
first,
|
||||
extra_args,
|
||||
continuation,
|
||||
pnc_style,
|
||||
} => Expr::DbgStmt {
|
||||
first: arena.alloc(first.normalize(arena)),
|
||||
extra_args: extra_args.normalize(arena),
|
||||
continuation: arena.alloc(continuation.normalize(arena)),
|
||||
pnc_style,
|
||||
},
|
||||
Expr::LowLevelDbg(x, a, b) => Expr::LowLevelDbg(
|
||||
x,
|
||||
|
@ -828,6 +830,7 @@ fn fold_defs<'a>(
|
|||
first,
|
||||
extra_args,
|
||||
continuation: arena.alloc(Loc::at_zero(rest)),
|
||||
pnc_style: false,
|
||||
};
|
||||
if new_defs.is_empty() {
|
||||
return new_final;
|
||||
|
@ -856,6 +859,7 @@ fn fold_defs<'a>(
|
|||
first,
|
||||
extra_args,
|
||||
continuation: arena.alloc(Loc::at_zero(rest)),
|
||||
pnc_style: true,
|
||||
};
|
||||
if new_defs.is_empty() {
|
||||
return new_final;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue