Correctly hook up the anyref table initialization

This functionality got lost in recent refactorings for WebIDL bindings
unfortunately, so this commit touches things up to ensure that the
anyref table initialization in anyref-mode is hooked up correctly, even
when tests are enabled. This invovled moving injection of the start
function to the webidl processing pass and ensuring its intrinsic is
registered in the internal maps of wasm-bindgen.
This commit is contained in:
Alex Crichton
2019-08-01 11:56:57 -07:00
parent 36db788829
commit 6e3e9d2dae
5 changed files with 63 additions and 54 deletions

View File

@ -194,10 +194,7 @@ impl<'a> Context<'a> {
// up we always remove the `start` function if one is present. The JS
// bindings glue then manually calls the start function (if it was
// previously present).
let mut needs_manual_start = false;
if self.config.emit_start {
needs_manual_start = self.unstart_start_function();
}
let needs_manual_start = self.unstart_start_function();
// After all we've done, especially
// `unexport_unused_internal_exports()`, we probably have a bunch of
@ -517,7 +514,10 @@ impl<'a> Context<'a> {
for (i, extra) in extra_modules.iter().enumerate() {
let imports = match &mut imports {
Some(list) => list,
None => bail!("cannot import from modules (`{}`) with `--no-modules`", extra),
None => bail!(
"cannot import from modules (`{}`) with `--no-modules`",
extra
),
};
imports.push_str(&format!("import * as __wbg_star{} from '{}';\n", i, extra));
imports_init.push_str(&format!("imports['{}'] = __wbg_star{};\n", extra, i));