groundwork for RoseTree

This commit is contained in:
Folkert 2021-01-23 01:39:04 +01:00
parent a4d7e809d2
commit 513d7cd78f
9 changed files with 304 additions and 29 deletions

View file

@ -359,6 +359,18 @@ pub fn decrement_refcount_layout<'a, 'ctx, 'env>(
build_dec_rec_union(env, layout_ids, tags, value.into_pointer_value(), true);
}
NonNullableUnwrapped(fields) => {
debug_assert!(value.is_pointer_value());
build_dec_rec_union(
env,
layout_ids,
&*env.arena.alloc([*fields]),
value.into_pointer_value(),
true,
);
}
NullableUnwrapped { other_fields, .. } => {
debug_assert!(value.is_pointer_value());
@ -484,6 +496,18 @@ pub fn increment_refcount_layout<'a, 'ctx, 'env>(
);
}
NonNullableUnwrapped(fields) => {
debug_assert!(value.is_pointer_value());
build_inc_rec_union(
env,
layout_ids,
&*env.arena.alloc([*fields]),
value.into_pointer_value(),
true,
);
}
Recursive(tags) => {
debug_assert!(value.is_pointer_value());
build_inc_rec_union(env, layout_ids, tags, value.into_pointer_value(), false);