mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Lift up more layouts
This commit is contained in:
parent
3c8b68d3bb
commit
ae7c899e51
1 changed files with 14 additions and 5 deletions
|
@ -183,6 +183,7 @@ fn build_eq<'a, 'ctx, 'env>(
|
||||||
env,
|
env,
|
||||||
layout_interner,
|
layout_interner,
|
||||||
layout_ids,
|
layout_ids,
|
||||||
|
*lhs_layout,
|
||||||
&union_layout,
|
&union_layout,
|
||||||
lhs_val,
|
lhs_val,
|
||||||
rhs_val,
|
rhs_val,
|
||||||
|
@ -228,6 +229,7 @@ fn build_eq<'a, 'ctx, 'env>(
|
||||||
env,
|
env,
|
||||||
layout_interner,
|
layout_interner,
|
||||||
layout_ids,
|
layout_ids,
|
||||||
|
rec_layout,
|
||||||
&union_layout,
|
&union_layout,
|
||||||
field1_cast.into(),
|
field1_cast.into(),
|
||||||
field2_cast.into(),
|
field2_cast.into(),
|
||||||
|
@ -242,6 +244,7 @@ fn build_neq_builtin<'a, 'ctx, 'env>(
|
||||||
layout_ids: &mut LayoutIds<'a>,
|
layout_ids: &mut LayoutIds<'a>,
|
||||||
lhs_val: BasicValueEnum<'ctx>,
|
lhs_val: BasicValueEnum<'ctx>,
|
||||||
rhs_val: BasicValueEnum<'ctx>,
|
rhs_val: BasicValueEnum<'ctx>,
|
||||||
|
builtin_layout: InLayout<'a>,
|
||||||
builtin: &Builtin<'a>,
|
builtin: &Builtin<'a>,
|
||||||
) -> BasicValueEnum<'ctx> {
|
) -> BasicValueEnum<'ctx> {
|
||||||
let int_cmp = |pred, label| {
|
let int_cmp = |pred, label| {
|
||||||
|
@ -307,7 +310,6 @@ fn build_neq_builtin<'a, 'ctx, 'env>(
|
||||||
result.into()
|
result.into()
|
||||||
}
|
}
|
||||||
Builtin::List(elem) => {
|
Builtin::List(elem) => {
|
||||||
let builtin_layout = layout_interner.insert(Layout::Builtin(*builtin));
|
|
||||||
let is_equal = build_list_eq(
|
let is_equal = build_list_eq(
|
||||||
env,
|
env,
|
||||||
layout_interner,
|
layout_interner,
|
||||||
|
@ -343,9 +345,15 @@ fn build_neq<'a, 'ctx, 'env>(
|
||||||
}
|
}
|
||||||
|
|
||||||
match layout_interner.get(lhs_layout) {
|
match layout_interner.get(lhs_layout) {
|
||||||
Layout::Builtin(builtin) => {
|
Layout::Builtin(builtin) => build_neq_builtin(
|
||||||
build_neq_builtin(env, layout_interner, layout_ids, lhs_val, rhs_val, &builtin)
|
env,
|
||||||
}
|
layout_interner,
|
||||||
|
layout_ids,
|
||||||
|
lhs_val,
|
||||||
|
rhs_val,
|
||||||
|
lhs_layout,
|
||||||
|
&builtin,
|
||||||
|
),
|
||||||
|
|
||||||
Layout::Struct { field_layouts, .. } => {
|
Layout::Struct { field_layouts, .. } => {
|
||||||
let is_equal = build_struct_eq(
|
let is_equal = build_struct_eq(
|
||||||
|
@ -369,6 +377,7 @@ fn build_neq<'a, 'ctx, 'env>(
|
||||||
env,
|
env,
|
||||||
layout_interner,
|
layout_interner,
|
||||||
layout_ids,
|
layout_ids,
|
||||||
|
lhs_layout,
|
||||||
&union_layout,
|
&union_layout,
|
||||||
lhs_val,
|
lhs_val,
|
||||||
rhs_val,
|
rhs_val,
|
||||||
|
@ -811,6 +820,7 @@ fn build_tag_eq<'a, 'ctx, 'env>(
|
||||||
env: &Env<'a, 'ctx, 'env>,
|
env: &Env<'a, 'ctx, 'env>,
|
||||||
layout_interner: &mut STLayoutInterner<'a>,
|
layout_interner: &mut STLayoutInterner<'a>,
|
||||||
layout_ids: &mut LayoutIds<'a>,
|
layout_ids: &mut LayoutIds<'a>,
|
||||||
|
tag_layout: InLayout<'a>,
|
||||||
union_layout: &UnionLayout<'a>,
|
union_layout: &UnionLayout<'a>,
|
||||||
tag1: BasicValueEnum<'ctx>,
|
tag1: BasicValueEnum<'ctx>,
|
||||||
tag2: BasicValueEnum<'ctx>,
|
tag2: BasicValueEnum<'ctx>,
|
||||||
|
@ -818,7 +828,6 @@ fn build_tag_eq<'a, 'ctx, 'env>(
|
||||||
let block = env.builder.get_insert_block().expect("to be in a function");
|
let block = env.builder.get_insert_block().expect("to be in a function");
|
||||||
let di_location = env.builder.get_current_debug_location().unwrap();
|
let di_location = env.builder.get_current_debug_location().unwrap();
|
||||||
|
|
||||||
let tag_layout = layout_interner.insert(Layout::Union(*union_layout));
|
|
||||||
let symbol = Symbol::GENERIC_EQ;
|
let symbol = Symbol::GENERIC_EQ;
|
||||||
let fn_name = layout_ids
|
let fn_name = layout_ids
|
||||||
.get(symbol, &tag_layout)
|
.get(symbol, &tag_layout)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue