func_by_index

This commit is contained in:
Sergey Pepyakin
2017-12-11 19:39:38 +01:00
parent c35d54bd9f
commit 79924b2ab6
3 changed files with 15 additions and 6 deletions

View File

@ -103,7 +103,9 @@ impl ProgramInstance {
let module_id = self.modules.get(module_name).ok_or_else(|| {
Error::Program(format!("Module {} not found", module_name))
})?;
let func_id = module_id.resolve_func(&self.store, func_idx);
let func_id = module_id.func_by_index(&self.store, func_idx).ok_or_else(|| {
Error::Program(format!("Module doesn't contain function at index {}", func_idx))
})?;
self.store.invoke(func_id, args, state)
}