mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-22 11:11:54 +00:00
fix also functions_section -> function_section
This commit is contained in:
@ -22,8 +22,8 @@ fn main() {
|
|||||||
&Section::Export(ref exports_section) => {
|
&Section::Export(ref exports_section) => {
|
||||||
println!(" Exports: {}", exports_section.entries().len());
|
println!(" Exports: {}", exports_section.entries().len());
|
||||||
},
|
},
|
||||||
&Section::Function(ref functions_section) => {
|
&Section::Function(ref function_section) => {
|
||||||
println!(" Functions: {}", functions_section.entries().len());
|
println!(" Functions: {}", function_section.entries().len());
|
||||||
},
|
},
|
||||||
&Section::Global(ref globals_section) => {
|
&Section::Global(ref globals_section) => {
|
||||||
println!(" Globals: {}", globals_section.entries().len());
|
println!(" Globals: {}", globals_section.entries().len());
|
||||||
|
@ -445,7 +445,7 @@ mod tests {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_eq!(module.type_section().expect("type section to exist").types().len(), 1);
|
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);
|
assert_eq!(module.code_section().expect("code section to exist").bodies().len(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ impl Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Functions signatures section, if any.
|
/// Functions signatures section, if any.
|
||||||
pub fn functions_section(&self) -> Option<&FunctionSection> {
|
pub fn function_section(&self) -> Option<&FunctionSection> {
|
||||||
for section in self.sections() {
|
for section in self.sections() {
|
||||||
if let &Section::Function(ref sect) = section { return Some(sect); }
|
if let &Section::Function(ref sect) = section { return Some(sect); }
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ impl ModuleInstanceInterface for ModuleInstance {
|
|||||||
// internal index = index of function in functions section && index of code in code section
|
// internal index = index of function in functions section && index of code in code section
|
||||||
// get function type index
|
// get function type index
|
||||||
let function_type_index = self.module
|
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)))
|
.ok_or(Error::Function(format!("trying to call function with index {} in module without function section", index)))
|
||||||
.and_then(|s| s.entries()
|
.and_then(|s| s.entries()
|
||||||
.get(index as usize)
|
.get(index as usize)
|
||||||
|
Reference in New Issue
Block a user