mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Fill out match expressions in generate_procs
This commit is contained in:
parent
d32d1e8e61
commit
2d887b297f
1 changed files with 46 additions and 14 deletions
|
@ -235,28 +235,60 @@ impl<'a> CodeGenHelp<'a> {
|
||||||
let procs_iter = specs.drain(0..).map(|(layout, op, proc_symbol)| match op {
|
let procs_iter = specs.drain(0..).map(|(layout, op, proc_symbol)| match op {
|
||||||
Inc | Dec | DecRef => {
|
Inc | Dec | DecRef => {
|
||||||
debug_assert!(Self::is_rc_implemented_yet(&layout));
|
debug_assert!(Self::is_rc_implemented_yet(&layout));
|
||||||
|
let rc_todo = || todo!("Please update is_rc_implemented_yet for `{:?}`", layout);
|
||||||
|
|
||||||
match layout {
|
match layout {
|
||||||
|
Layout::Builtin(
|
||||||
|
Builtin::Int(_) | Builtin::Float(_) | Builtin::Bool | Builtin::Decimal,
|
||||||
|
) => unreachable!("Not refcounted: {:?}", layout),
|
||||||
Layout::Builtin(Builtin::Str) => {
|
Layout::Builtin(Builtin::Str) => {
|
||||||
self.gen_modify_str(ident_ids, op, proc_symbol)
|
self.gen_modify_str(ident_ids, op, proc_symbol)
|
||||||
}
|
}
|
||||||
|
Layout::Builtin(Builtin::Dict(_, _) | Builtin::Set(_) | Builtin::List(_)) => {
|
||||||
|
rc_todo()
|
||||||
|
}
|
||||||
|
Layout::Struct(_) => rc_todo(),
|
||||||
|
Layout::Union(union_layout) => match union_layout {
|
||||||
|
UnionLayout::NonRecursive(_) => rc_todo(),
|
||||||
|
UnionLayout::Recursive(_) => rc_todo(),
|
||||||
|
UnionLayout::NonNullableUnwrapped(_) => rc_todo(),
|
||||||
|
UnionLayout::NullableWrapped { .. } => rc_todo(),
|
||||||
|
UnionLayout::NullableUnwrapped { .. } => rc_todo(),
|
||||||
|
},
|
||||||
|
Layout::LambdaSet(_) => unreachable!(
|
||||||
|
"Refcounting on LambdaSet is invalid. Should be a Union at runtime."
|
||||||
|
),
|
||||||
|
Layout::RecursivePointer => rc_todo(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Eq => {
|
||||||
|
let eq_todo = || todo!("Specialized `==` operator for `{:?}`", layout);
|
||||||
|
|
||||||
_ => todo!("Please update is_rc_implemented_yet for `{:?}`", layout),
|
match layout {
|
||||||
}
|
|
||||||
}
|
|
||||||
Eq => match layout {
|
|
||||||
Layout::Builtin(
|
Layout::Builtin(
|
||||||
Builtin::Int(_) | Builtin::Float(_) | Builtin::Bool | Builtin::Decimal,
|
Builtin::Int(_) | Builtin::Float(_) | Builtin::Bool | Builtin::Decimal,
|
||||||
) => panic!(
|
) => unreachable!(
|
||||||
"No generated helper proc. Use direct code gen for {:?}",
|
"No generated proc for `==`. Use direct code gen for {:?}",
|
||||||
layout
|
layout
|
||||||
),
|
),
|
||||||
|
|
||||||
Layout::Builtin(Builtin::Str) => {
|
Layout::Builtin(Builtin::Str) => {
|
||||||
panic!("No generated helper proc. Use Zig builtin for Str.")
|
unreachable!("No generated helper proc for `==` on Str. Use Zig function.")
|
||||||
}
|
}
|
||||||
|
Layout::Builtin(Builtin::Dict(_, _) | Builtin::Set(_) | Builtin::List(_)) => {
|
||||||
_ => todo!("Specialized equality check for `{:?}`", layout),
|
eq_todo()
|
||||||
|
}
|
||||||
|
Layout::Struct(_) => eq_todo(),
|
||||||
|
Layout::Union(union_layout) => match union_layout {
|
||||||
|
UnionLayout::NonRecursive(_) => eq_todo(),
|
||||||
|
UnionLayout::Recursive(_) => eq_todo(),
|
||||||
|
UnionLayout::NonNullableUnwrapped(_) => eq_todo(),
|
||||||
|
UnionLayout::NullableWrapped { .. } => eq_todo(),
|
||||||
|
UnionLayout::NullableUnwrapped { .. } => eq_todo(),
|
||||||
},
|
},
|
||||||
|
Layout::LambdaSet(_) => unreachable!("`==` is not defined on functions"),
|
||||||
|
Layout::RecursivePointer => eq_todo(),
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Vec::from_iter_in(procs_iter, arena)
|
Vec::from_iter_in(procs_iter, arena)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue