mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
WIP things seem to work in theory
This commit is contained in:
parent
845e30658e
commit
53bd47221c
6 changed files with 213 additions and 137 deletions
|
@ -200,6 +200,7 @@ pub enum Expr<'a> {
|
|||
index: u64,
|
||||
field_layouts: &'a [Layout<'a>],
|
||||
expr: &'a Expr<'a>,
|
||||
is_unwrapped: bool,
|
||||
},
|
||||
|
||||
Array {
|
||||
|
@ -893,11 +894,11 @@ fn store_pattern2<'a>(
|
|||
AppliedTag {
|
||||
union, arguments, ..
|
||||
} => {
|
||||
let is_unwrapped = (union.alternatives.len() > 1) as usize;
|
||||
let is_unwrapped = union.alternatives.len() == 1;
|
||||
|
||||
let mut arg_layouts = Vec::with_capacity_in(arguments.len(), env.arena);
|
||||
|
||||
if is_unwrapped != 0 {
|
||||
if !is_unwrapped {
|
||||
arg_layouts.push(Layout::Builtin(Builtin::Byte(MutMap::default())));
|
||||
}
|
||||
|
||||
|
@ -907,7 +908,8 @@ fn store_pattern2<'a>(
|
|||
|
||||
for (index, (argument, arg_layout)) in arguments.iter().enumerate() {
|
||||
let load = Expr::AccessAtIndex {
|
||||
index: (is_unwrapped + index) as u64,
|
||||
is_unwrapped,
|
||||
index: (!is_unwrapped as usize + index) as u64,
|
||||
field_layouts: arg_layouts.clone().into_bump_slice(),
|
||||
expr: env.arena.alloc(Expr::Load(outer_symbol)),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue