mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24: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,7 +516,10 @@ impl<'a> DataSection<'a> {
|
||||||
|
|
||||||
impl Serialize for DataSection<'_> {
|
impl Serialize for DataSection<'_> {
|
||||||
fn serialize<T: SerialBuffer>(&self, buffer: &mut T) {
|
fn serialize<T: SerialBuffer>(&self, buffer: &mut T) {
|
||||||
serialize_vector_section(buffer, SectionId::Data, &self.segments);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue