Fix importing static values of non-JS types

This hasn't ever actually worked in `wasm-bindgen` but there's been
enough refactorings since the initial implementation that it's actually
quite trivial to implement now!

Closes #1777
This commit is contained in:
Alex Crichton
2019-09-23 08:23:21 -07:00
parent e809a45c61
commit 0afb6aafd3
4 changed files with 24 additions and 1 deletions

View File

@ -1049,6 +1049,11 @@ impl<'a> Context<'a> {
None => return Ok(()),
};
let descriptor = match self.descriptors.remove(static_.shim) {
None => return Ok(()),
Some(d) => d,
};
// Register the signature of this imported shim
bindings::register_import(
self.module,
@ -1057,7 +1062,7 @@ impl<'a> Context<'a> {
Function {
arguments: Vec::new(),
shim_idx: 0,
ret: Descriptor::Anyref,
ret: descriptor,
},
ast::WebidlFunctionKind::Static,
)?;