Use the WasmRuntime's type list rather than keeping a separate list.

This commit is contained in:
Dan Gohman
2017-10-06 16:16:39 -07:00
parent 90ed698e83
commit 3841552b7c
4 changed files with 14 additions and 11 deletions

View File

@@ -113,19 +113,17 @@ pub fn parse_import_section(
pub fn parse_function_section(
parser: &mut Parser,
runtime: &mut WasmRuntime,
) -> Result<Vec<SignatureIndex>, SectionParsingError> {
let mut funcs = Vec::new();
) -> Result<(), SectionParsingError> {
loop {
match *parser.read() {
ParserState::FunctionSectionEntry(sigindex) => {
runtime.declare_func_type(sigindex as SignatureIndex);
funcs.push(sigindex as SignatureIndex);
}
ParserState::EndSection => break,
ref s => return Err(SectionParsingError::WrongSectionContent(format!("{:?}", s))),
};
}
Ok(funcs)
Ok(())
}
/// Retrieves the names of the functions from the export section