Re-use registered module instances in spectests

This commit is contained in:
Brandon Fish
2019-08-10 15:56:25 -06:00
parent 1f8f810222
commit 228d562a3b
3 changed files with 54 additions and 72 deletions

View File

@ -500,6 +500,23 @@ impl LikeNamespace for Instance {
}
}
use std::rc::Rc;
impl LikeNamespace for Rc<Instance> {
fn get_export(&self, name: &str) -> Option<Export> {
let export_index = self.module.info.exports.get(name)?;
Some(self.inner.get_export_from_index(&self.module, export_index))
}
fn get_exports(&self) -> Vec<(String, Export)> {
unimplemented!("Use the exports method instead");
}
fn maybe_insert(&mut self, _name: &str, _export: Export) -> Option<()> {
None
}
}
#[must_use]
fn call_func_with_index(
info: &ModuleInfo,