fix also functions_section -> function_section

This commit is contained in:
NikVolf
2017-06-03 23:37:36 +03:00
parent 8eb78497d3
commit a080b42db0
4 changed files with 5 additions and 5 deletions

View File

@ -22,8 +22,8 @@ fn main() {
&Section::Export(ref exports_section) => {
println!(" Exports: {}", exports_section.entries().len());
},
&Section::Function(ref functions_section) => {
println!(" Functions: {}", functions_section.entries().len());
&Section::Function(ref function_section) => {
println!(" Functions: {}", function_section.entries().len());
},
&Section::Global(ref globals_section) => {
println!(" Globals: {}", globals_section.entries().len());

View File

@ -445,7 +445,7 @@ mod tests {
.build();
assert_eq!(module.type_section().expect("type section to exist").types().len(), 1);
assert_eq!(module.functions_section().expect("function section to exist").entries().len(), 1);
assert_eq!(module.function_section().expect("function section to exist").entries().len(), 1);
assert_eq!(module.code_section().expect("code section to exist").bodies().len(), 1);
}

View File

@ -123,7 +123,7 @@ impl Module {
}
/// Functions signatures section, if any.
pub fn functions_section(&self) -> Option<&FunctionSection> {
pub fn function_section(&self) -> Option<&FunctionSection> {
for section in self.sections() {
if let &Section::Function(ref sect) = section { return Some(sect); }
}

View File

@ -318,7 +318,7 @@ impl ModuleInstanceInterface for ModuleInstance {
// internal index = index of function in functions section && index of code in code section
// get function type index
let function_type_index = self.module
.functions_section()
.function_section()
.ok_or(Error::Function(format!("trying to call function with index {} in module without function section", index)))
.and_then(|s| s.entries()
.get(index as usize)