Remove generated spectest codes from repo.

This commit is contained in:
Lachlan Sneff
2019-01-12 23:48:21 -05:00
parent a7ffb44bbc
commit a9e58203f2
72 changed files with 159 additions and 236465 deletions

View File

@ -5,17 +5,6 @@ pub trait Namespace {
fn get_export(&self, name: &str) -> Option<Export>;
}
impl Namespace for HashMap<String, Export> {
fn get_export(&self, name: &str) -> Option<Export> {
self.get(name).cloned()
}
}
impl<'a> Namespace for HashMap<&'a str, Export> {
fn get_export(&self, name: &str) -> Option<Export> {
self.get(name).cloned()
}
}
pub struct Imports {
map: HashMap<String, Box<dyn Namespace>>,
}
@ -45,3 +34,25 @@ impl Imports {
self.map.get(namespace).map(|namespace| &**namespace)
}
}
pub struct NamespaceMap {
map: HashMap<String, Export>
}
impl NamespaceMap {
pub fn new() -> Self {
Self {
map: HashMap::new(),
}
}
pub fn insert(&mut self, name: impl Into<String>, export: Export) -> Option<Export> {
self.map.insert(name.into(), export)
}
}
impl Namespace for NamespaceMap {
fn get_export(&self, name: &str) -> Option<Export> {
self.map.get(name).cloned()
}
}

View File

@ -42,7 +42,8 @@ impl Module {
}
/// Instantiate a webassembly module with the provided imports.
pub fn instantiate(&self, imports: &Imports) -> Result<Instance, String> {
pub fn instantiate(&self, imports: &Imports) -> Result<Instance, String>
{
Instance::new(Rc::clone(&self.0), imports)
}
}