mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-31 17:17:26 +00:00
clone structs and tags if they are copy
This commit is contained in:
parent
d4feaf871b
commit
984000095f
1 changed files with 17 additions and 17 deletions
|
@ -144,27 +144,27 @@ fn build_clone<'a, 'ctx, 'env>(
|
||||||
build_clone_builtin(env, ptr, offset, value, builtin, when_recursive)
|
build_clone_builtin(env, ptr, offset, value, builtin, when_recursive)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
Layout::Struct {
|
||||||
Layout::Struct { field_layouts, .. } => build_struct_eq(
|
field_layouts: _, ..
|
||||||
env,
|
} => {
|
||||||
layout_ids,
|
if layout.safe_to_memcpy() {
|
||||||
field_layouts,
|
build_copy(env, ptr, offset, value)
|
||||||
when_recursive,
|
} else {
|
||||||
lhs_val.into_struct_value(),
|
todo!()
|
||||||
rhs_val.into_struct_value(),
|
}
|
||||||
),
|
}
|
||||||
|
|
||||||
Layout::LambdaSet(_) => unreachable!("cannot compare closures"),
|
Layout::LambdaSet(_) => unreachable!("cannot compare closures"),
|
||||||
|
|
||||||
Layout::Union(union_layout) => build_tag_eq(
|
Layout::Union(_union_layout) => {
|
||||||
env,
|
if layout.safe_to_memcpy() {
|
||||||
layout_ids,
|
build_copy(env, ptr, offset, value)
|
||||||
when_recursive,
|
} else {
|
||||||
union_layout,
|
todo!()
|
||||||
lhs_val,
|
}
|
||||||
rhs_val,
|
}
|
||||||
),
|
|
||||||
|
|
||||||
|
/*
|
||||||
Layout::Boxed(inner_layout) => build_box_eq(
|
Layout::Boxed(inner_layout) => build_box_eq(
|
||||||
env,
|
env,
|
||||||
layout_ids,
|
layout_ids,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue