mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
fix not being able to dbg variable
This commit is contained in:
parent
74e1bc412f
commit
07b7a93b9f
3 changed files with 26 additions and 10 deletions
|
@ -6570,16 +6570,24 @@ pub fn from_can<'a>(
|
|||
let expr = Expr::Call(call);
|
||||
let mut stmt = Stmt::Let(dbg_symbol, expr, dbg_layout, env.arena.alloc(rest));
|
||||
|
||||
stmt = with_hole(
|
||||
env,
|
||||
loc_condition.value,
|
||||
variable,
|
||||
procs,
|
||||
layout_cache,
|
||||
dbg_symbol,
|
||||
env.arena.alloc(stmt),
|
||||
let symbol_is_reused = matches!(
|
||||
can_reuse_symbol(env, procs, &loc_condition.value, variable),
|
||||
ReuseSymbol::Value(_)
|
||||
);
|
||||
|
||||
// skip evaluating the condition if it's just a symbol
|
||||
if !symbol_is_reused {
|
||||
stmt = with_hole(
|
||||
env,
|
||||
loc_condition.value,
|
||||
variable,
|
||||
procs,
|
||||
layout_cache,
|
||||
dbg_symbol,
|
||||
env.arena.alloc(stmt),
|
||||
);
|
||||
}
|
||||
|
||||
stmt
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue