Fix function offset.

This commit is contained in:
Heyang Zhou
2019-05-07 08:25:46 -07:00
parent 0895dc60c2
commit 0bbd6e6970
3 changed files with 5 additions and 11 deletions

View File

@ -220,7 +220,7 @@ impl Instance {
}
}
pub fn resolve_local_func(&self, name: &str) -> ResolveResult<usize> {
pub fn resolve_func(&self, name: &str) -> ResolveResult<usize> {
let export_index =
self.module
.info
@ -231,13 +231,7 @@ impl Instance {
})?;
if let ExportIndex::Func(func_index) = export_index {
match func_index.local_or_import(&self.module.info) {
LocalOrImport::Local(x) => Ok(x.index()),
LocalOrImport::Import(x) => Err(ResolveError::ExportWrongType {
name: name.to_string(),
}
.into())
}
Ok(func_index.index())
} else {
Err(ResolveError::ExportWrongType {
name: name.to_string(),