mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Lift another branch
This commit is contained in:
parent
a59739bf20
commit
7c1a6037d4
1 changed files with 10 additions and 59 deletions
|
@ -3813,9 +3813,8 @@ 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,
|
||||||
|
@ -3823,55 +3822,7 @@ pub fn with_hole<'a>(
|
||||||
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) =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue