wasm: Explicit exhaustiveness on conditionals for higher-order lowlevels

This commit is contained in:
Brian Carroll 2022-07-07 20:32:54 +01:00
parent a6faf875f8
commit c32ce44b29
No known key found for this signature in database
GPG Key ID: 9CF4E3BF9C4722C7

View File

@ -2033,7 +2033,10 @@ pub fn call_higher_order_lowlevel<'a>(
.unwrap(); .unwrap();
match op { match op {
ListSortWith { .. } => ProcSource::HigherOrderCompare(passed_proc_index), ListSortWith { .. } => ProcSource::HigherOrderCompare(passed_proc_index),
_ => ProcSource::HigherOrderMapper(passed_proc_index), ListMap { .. } | ListMap2 { .. } | ListMap3 { .. } | ListMap4 { .. } => {
ProcSource::HigherOrderMapper(passed_proc_index)
}
DictWalk { .. } => todo!("DictWalk"),
} }
}; };
let wrapper_sym = backend.create_symbol(&format!("#wrap#{:?}", fn_name)); let wrapper_sym = backend.create_symbol(&format!("#wrap#{:?}", fn_name));
@ -2055,19 +2058,23 @@ pub fn call_higher_order_lowlevel<'a>(
.map(Layout::Boxed), .map(Layout::Boxed),
); );
if let ProcSource::HigherOrderMapper(_) = helper_proc_source { match helper_proc_source {
// Our convention for mappers is that they write to the heap via the last argument ProcSource::HigherOrderMapper(_) => {
wrapper_arg_layouts.push(Layout::Boxed(result_layout)); // Our convention for mappers is that they write to the heap via the last argument
ProcLayout { wrapper_arg_layouts.push(Layout::Boxed(result_layout));
arguments: wrapper_arg_layouts.into_bump_slice(), ProcLayout {
result: Layout::UNIT, arguments: wrapper_arg_layouts.into_bump_slice(),
captures_niche: fn_name.captures_niche(), result: Layout::UNIT,
captures_niche: fn_name.captures_niche(),
}
} }
} else { ProcSource::HigherOrderCompare(_) => ProcLayout {
ProcLayout {
arguments: wrapper_arg_layouts.into_bump_slice(), arguments: wrapper_arg_layouts.into_bump_slice(),
result: *result_layout, result: *result_layout,
captures_niche: fn_name.captures_niche(), captures_niche: fn_name.captures_niche(),
},
ProcSource::Roc | ProcSource::Helper => {
internal_error!("Should never reach here for {:?}", helper_proc_source)
} }
} }
}; };