make record variable names clearer

This commit is contained in:
Folkert 2020-03-14 01:01:14 +01:00
parent 1a8f380033
commit e62ddc9ef5
5 changed files with 29 additions and 17 deletions

View file

@ -619,7 +619,9 @@ fn from_can<'a>(
expr
}
Record(ext_var, fields) => {
Record {
record_var, fields, ..
} => {
let arena = env.arena;
let mut field_bodies = Vec::with_capacity_in(fields.len(), arena);
@ -629,13 +631,14 @@ fn from_can<'a>(
field_bodies.push((label, expr));
}
let struct_layout = match Layout::from_var(arena, ext_var, env.subs, env.pointer_size) {
Ok(layout) => layout,
Err(()) => {
// Invalid field!
panic!("TODO gracefully handle Record with invalid struct_layout");
}
};
let struct_layout =
match Layout::from_var(arena, record_var, env.subs, env.pointer_size) {
Ok(layout) => layout,
Err(()) => {
// Invalid field!
panic!("TODO gracefully handle Record with invalid struct_layout");
}
};
Expr::Struct {
fields: field_bodies.into_bump_slice(),