initial implementation

This commit is contained in:
Folkert 2022-03-08 19:09:42 +01:00
parent b3b3b8790c
commit 92f2927046
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
13 changed files with 313 additions and 2 deletions

View file

@ -34,6 +34,7 @@ pub fn eq_generic<'a>(
Layout::Builtin(Builtin::List(elem_layout)) => eq_list(root, ident_ids, ctx, elem_layout),
Layout::Struct { field_layouts, .. } => eq_struct(root, ident_ids, ctx, field_layouts),
Layout::Union(union_layout) => eq_tag_union(root, ident_ids, ctx, union_layout),
Layout::Boxed(inner_layout) => eq_boxed(root, ident_ids, ctx, inner_layout),
Layout::LambdaSet(_) => unreachable!("`==` is not defined on functions"),
Layout::RecursivePointer => {
unreachable!(
@ -528,6 +529,15 @@ fn eq_tag_fields<'a>(
stmt
}
fn eq_boxed<'a>(
root: &mut CodeGenHelp<'a>,
ident_ids: &mut IdentIds,
ctx: &mut Context<'a>,
inner_layout: &'a Layout<'a>,
) -> Stmt<'a> {
todo!()
}
/// List equality
/// We can't use `ListGetUnsafe` because it increments the refcount, and we don't want that.
/// Another way to dereference a heap pointer is to use `Expr::UnionAtIndex`.