Finalize signatures & names when no function bodies

This commit is contained in:
Brandon Fish
2019-08-12 20:22:54 -06:00
parent a4979f9909
commit e76777ed9b
2 changed files with 14 additions and 53 deletions

View File

@ -369,12 +369,17 @@ pub fn read_module<
info.write().unwrap().globals.push(global_init);
}
ParserState::EndWasm => {
if namespace_builder.is_some() {
// TODO Consolidate with BeginFunction body if possible
if func_count == ::std::usize::MAX {
info.write().unwrap().namespace_table =
namespace_builder.take().unwrap().finish();
}
if name_builder.is_some() {
info.write().unwrap().name_table = name_builder.take().unwrap().finish();
mcg.feed_signatures(info.read().unwrap().signatures.clone())
.map_err(|x| LoadError::Codegen(format!("{:?}", x)))?;
mcg.feed_function_signatures(info.read().unwrap().func_assoc.clone())
.map_err(|x| LoadError::Codegen(format!("{:?}", x)))?;
mcg.check_precondition(&info.read().unwrap())
.map_err(|x| LoadError::Codegen(format!("{:?}", x)))?;
}
break;
}