Add a check if NotStartedModuleRef has a start function (#173)
* Add a check if NotStartedModuleRef has a start function * Removed redundant doc comment Co-Authored-By: elichai <elichai.turkel@gmail.com>
This commit is contained in:
parent
188ad62955
commit
8403cc3411
|
@ -714,6 +714,13 @@ impl<'a> NotStartedModuleRef<'a> {
|
||||||
}
|
}
|
||||||
self.instance
|
self.instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether or not the module has a `start` function.
|
||||||
|
///
|
||||||
|
/// Returns `true` if it has a `start` function.
|
||||||
|
pub fn has_start(&self) -> bool {
|
||||||
|
self.loaded_module.module().start_section().is_some()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eval_init_expr(init_expr: &InitExpr, module: &ModuleInstance) -> RuntimeValue {
|
fn eval_init_expr(init_expr: &InitExpr, module: &ModuleInstance) -> RuntimeValue {
|
||||||
|
@ -793,9 +800,9 @@ mod tests {
|
||||||
(start $f))
|
(start $f))
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
ModuleInstance::new(&module_with_start, &ImportsBuilder::default())
|
let module = ModuleInstance::new(&module_with_start, &ImportsBuilder::default()).unwrap();
|
||||||
.unwrap()
|
assert!(!module.has_start());
|
||||||
.assert_no_start();
|
module.assert_no_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue