only emit global section when not empty

This commit is contained in:
2021-11-08 23:15:29 +01:00
parent 63012947f3
commit 41ec5a770f
2 changed files with 5 additions and 16 deletions

View File

@@ -112,7 +112,9 @@ pub fn emit(script: &ast::Script) -> Vec<u8> {
}
module.section(&functions);
module.section(&global_section);
if !script.global_vars.is_empty() {
module.section(&global_section);
}
module.section(&exports);
module.section(&code);
}