Lift another branch

This commit is contained in:
Ayaz Hafiz 2022-05-09 16:39:06 -04:00
parent a59739bf20
commit 7c1a6037d4
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -3813,65 +3813,16 @@ pub fn with_hole<'a>(
} }
} }
LetNonRec(def, cont) => { LetNonRec(def, cont) => {
if let roc_can::pattern::Pattern::Identifier(symbol) = def.loc_pattern.value { if let roc_can::pattern::Pattern::Identifier(_) = def.loc_pattern.value {
if matches!(def.loc_expr.value, Closure(_)) { from_can_let(
return from_can_let( env,
env, procs,
procs, layout_cache,
layout_cache, def,
def, cont,
cont, variable,
variable, Some((assigned, hole)),
Some((assigned, hole)), )
);
}
let build_rest =
|env: &mut Env<'a, '_>,
procs: &mut Procs<'a>,
layout_cache: &mut LayoutCache<'a>| {
with_hole(
env,
cont.value,
variable,
procs,
layout_cache,
assigned,
hole,
)
};
// a variable is aliased
if let roc_can::expr::Expr::Var(original) = def.loc_expr.value {
// a variable is aliased, e.g.
//
// foo = bar
//
// or
//
// foo = RBTRee.empty
handle_variable_aliasing(
env,
procs,
layout_cache,
def.expr_var,
symbol,
original,
build_rest,
)
} else {
let rest = build_rest(env, procs, layout_cache);
with_hole(
env,
def.loc_expr.value,
def.expr_var,
procs,
layout_cache,
symbol,
env.arena.alloc(rest),
)
}
} else { } else {
// this may be a destructure pattern // this may be a destructure pattern
let (mono_pattern, assignments) = let (mono_pattern, assignments) =