Skip to content

Commit 034b82b

Browse files
committed
wasmtime::component: make it possible to typecheck export funcs
1 parent 1a9e623 commit 034b82b

File tree

1 file changed

+12
-0
lines changed
  • crates/wasmtime/src/runtime/component

1 file changed

+12
-0
lines changed

crates/wasmtime/src/runtime/component/types.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,18 @@ impl ComponentFunc {
725725
.iter()
726726
.map(|ty| Type::from(ty, &self.0.instance()))
727727
}
728+
729+
#[doc(hidden)]
730+
pub fn typecheck<Params, Return>(&self, cx: &InstanceType) -> anyhow::Result<()>
731+
where
732+
Params: crate::component::ComponentNamedList + crate::component::Lower,
733+
Return: crate::component::ComponentNamedList + crate::component::Lift,
734+
{
735+
let ty = &self.0.types[self.0.index];
736+
Params::typecheck(&InterfaceType::Tuple(ty.params), cx)?;
737+
Return::typecheck(&InterfaceType::Tuple(ty.results), cx)?;
738+
Ok(())
739+
}
728740
}
729741

730742
/// Core module type

0 commit comments

Comments
 (0)