mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Don't generate a DataSection unless we actually need it!
This commit is contained in:
parent
c798c9d444
commit
0d1946a782
1 changed files with 4 additions and 1 deletions
|
@ -516,8 +516,11 @@ impl<'a> DataSection<'a> {
|
|||
|
||||
impl Serialize for DataSection<'_> {
|
||||
fn serialize<T: SerialBuffer>(&self, buffer: &mut T) {
|
||||
let total_payload_size = self.segments.iter().map(|seg| seg.init.len()).sum();
|
||||
if total_payload_size > 0 {
|
||||
serialize_vector_section(buffer, SectionId::Data, &self.segments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn write_data_count_section<'a, T: SerialBuffer>(buffer: &mut T, data_section: &DataSection<'a>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue