Remove entries for tables with no elements

This commit is contained in:
Rerumu 2022-07-07 20:10:47 -04:00
parent cdefb2f06a
commit bdfede0b93
2 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,10 @@ struct Visit {
impl Visitor for Visit {
fn visit_br_table(&mut self, table: &BrTable) {
if table.data().is_empty() {
return;
}
let id = table as *const _ as usize;
let len = self.id_map.len() + 1;

View File

@ -20,10 +20,15 @@ impl Visitor for Visit {
}
fn visit_br_table(&mut self, table: &BrTable) {
self.has_branch = true;
if table.data().is_empty() {
return;
}
let id = table as *const _ as usize;
let len = self.br_map.len() + 1;
self.has_branch = true;
self.br_map.insert(id, len);
}
}