mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Don't turn pnc apply dbg into DbgStmt
This commit is contained in:
parent
6d324590da
commit
6d2b635dbc
7 changed files with 103 additions and 82 deletions
|
@ -3166,40 +3166,6 @@ fn stmts_to_defs<'a>(
|
|||
|
||||
last_expr = Some(Loc::at(sp_stmt.item.region, e));
|
||||
|
||||
// don't re-process the rest of the statements; they got consumed by the dbg expr
|
||||
break;
|
||||
} else {
|
||||
defs.push_value_def(
|
||||
ValueDef::Stmt(arena.alloc(Loc::at(sp_stmt.item.region, e))),
|
||||
sp_stmt.item.region,
|
||||
sp_stmt.before,
|
||||
&[],
|
||||
);
|
||||
}
|
||||
} else if let Expr::PncApply(
|
||||
Loc {
|
||||
value: Expr::Dbg, ..
|
||||
},
|
||||
args,
|
||||
) = e
|
||||
{
|
||||
if let Some((first, extra_args)) = args.items.split_first() {
|
||||
let rest = stmts_to_expr(&stmts[i + 1..], arena)?;
|
||||
let e = Expr::DbgStmt {
|
||||
first,
|
||||
extra_args,
|
||||
continuation: arena.alloc(rest),
|
||||
pnc_style: true,
|
||||
};
|
||||
|
||||
let e = if sp_stmt.before.is_empty() {
|
||||
e
|
||||
} else {
|
||||
arena.alloc(e).before(sp_stmt.before)
|
||||
};
|
||||
|
||||
last_expr = Some(Loc::at(sp_stmt.item.region, e));
|
||||
|
||||
// don't re-process the rest of the statements; they got consumed by the dbg expr
|
||||
break;
|
||||
} else {
|
||||
|
|
|
@ -843,35 +843,6 @@ fn fold_defs<'a>(
|
|||
new_defs.push_value_def(vd, Region::zero(), &[], &[]);
|
||||
}
|
||||
}
|
||||
ValueDef::Stmt(&Loc {
|
||||
value:
|
||||
Expr::PncApply(
|
||||
&Loc {
|
||||
value: Expr::Dbg, ..
|
||||
},
|
||||
args,
|
||||
),
|
||||
..
|
||||
}) => {
|
||||
if let Some((first, extra_args)) = args.items.split_first() {
|
||||
let rest = fold_defs(arena, defs, final_expr);
|
||||
let new_final = Expr::DbgStmt {
|
||||
first,
|
||||
extra_args,
|
||||
continuation: arena.alloc(Loc::at_zero(rest)),
|
||||
pnc_style: true,
|
||||
};
|
||||
if new_defs.is_empty() {
|
||||
return new_final;
|
||||
}
|
||||
return Expr::Defs(
|
||||
arena.alloc(new_defs),
|
||||
arena.alloc(Loc::at_zero(new_final)),
|
||||
);
|
||||
} else {
|
||||
new_defs.push_value_def(vd, Region::zero(), &[], &[]);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
new_defs.push_value_def(vd, Region::zero(), &[], &[]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue