Remove leading and trailing blanks from the --no-modules output

The output using modules already uses string formatting that carefully
avoids emitting leading and trailing blanks; adjust the --no-modules
output to match.
This commit is contained in:
Josh Triplett 2018-09-13 22:10:59 -07:00
parent 05a0a5c6a1
commit 1c52fb1b2f

View File

@ -417,7 +417,7 @@ impl<'a> Context<'a> {
let mut js = if self.config.no_modules { let mut js = if self.config.no_modules {
format!( format!(
" "\
(function() {{ (function() {{
var wasm; var wasm;
const __exports = {{}}; const __exports = {{}};
@ -438,8 +438,7 @@ impl<'a> Context<'a> {
}}); }});
}}; }};
self.{global_name} = Object.assign(init, __exports); self.{global_name} = Object.assign(init, __exports);
}})(); }})();",
",
globals = self.globals, globals = self.globals,
module = module_name, module = module_name,
global_name = self.config.no_modules_global global_name = self.config.no_modules_global