This commit is contained in:
Folkert 2021-06-16 23:18:56 +02:00
parent 6d31f9e1da
commit 642271d730

View file

@ -860,7 +860,7 @@ fn expr_spec(
Struct(fields) => build_tuple_value(builder, env, block, fields), Struct(fields) => build_tuple_value(builder, env, block, fields),
AccessAtIndex { AccessAtIndex {
index, index,
field_layouts, field_layouts: _,
structure, structure,
wrapped, wrapped,
} => { } => {
@ -886,18 +886,14 @@ fn expr_spec(
} }
Wrapped::MultiTagUnion => { Wrapped::MultiTagUnion => {
// Clearly this is not generally correct, but it should be for our examples // Clearly this is not generally correct, but it should be for our examples
let hacky_is_recursive = // let hacky_is_recursive = field_layouts.iter().any(|l| l == &Layout::RecursivePointer);
field_layouts.iter().any(|l| l == &Layout::RecursivePointer); // if hacky_is_recursive {
if hacky_is_recursive { // we don't know what constructor we are at this point, so how can we get a
let result_type = layout_spec(builder, layout)?; // field from an enum value?
builder.add_unknown_with(block, &[value_id], result_type)
} else { let result_type = layout_spec(builder, layout)?;
// what to do, what to do. builder.add_unknown_with(block, &[value_id], result_type)
let result_type = layout_spec(builder, layout)?;
builder.add_unknown_with(block, &[value_id], result_type)
// builder.add_get_tuple_field(block, value_id, *index as u32)
}
} }
} }
} }