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

This way, if the runtime modifies the signature, such as to add special
arguments, they are reflected in the resulting function defintions.
This commit is contained in:
Dan Gohman
2017-10-04 16:55:14 -07:00
parent 196795017b
commit 7410ddfe08
4 changed files with 11 additions and 8 deletions

View File

@@ -27,8 +27,7 @@ pub enum SectionParsingError {
pub fn parse_function_signatures(
parser: &mut Parser,
runtime: &mut WasmRuntime,
) -> Result<Vec<Signature>, SectionParsingError> {
let mut signatures: Vec<Signature> = Vec::new();
) -> Result<(), SectionParsingError> {
loop {
match *parser.read() {
ParserState::EndSection => break,
@@ -51,12 +50,11 @@ pub fn parse_function_signatures(
ArgumentType::new(cret_arg)
}));
runtime.declare_signature(&sig);
signatures.push(sig);
}
ref s => return Err(SectionParsingError::WrongSectionContent(format!("{:?}", s))),
}
}
Ok(signatures)
Ok(())
}
/// Retrieves the imports from the imports section of the binary.