mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
wasm: fix panic on empty Struct expression
This commit is contained in:
parent
28a3ae85e3
commit
1afada4075
1 changed files with 3 additions and 1 deletions
|
@ -936,11 +936,13 @@ impl<'a> WasmBackend<'a> {
|
|||
}
|
||||
_ => internal_error!("Cannot create struct {:?} with storage {:?}", sym, storage),
|
||||
};
|
||||
} else {
|
||||
} else if !fields.is_empty() {
|
||||
// Struct expression but not Struct layout => single element. Copy it.
|
||||
let field_storage = self.storage.get(&fields[0]).to_owned();
|
||||
self.storage
|
||||
.clone_value(&mut self.code_builder, storage, &field_storage, fields[0]);
|
||||
} else {
|
||||
// Empty record. Nothing to do.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue