Creates a `LowerContext` using the configuration values of this lifted function. The `lower` closure provided should perform the actual lowering and return the result of the lowering operation which is then returned from this function as well.
(
self,
mut store: StoreContextMut<T>,
lower: impl FnOnce(&mut LowerContext<T>, InterfaceType) -> Result<()>,
)
| 666 | /// return the result of the lowering operation which is then returned from |
| 667 | /// this function as well. |
| 668 | pub(crate) fn with_lower_context<T>( |
| 669 | self, |
| 670 | mut store: StoreContextMut<T>, |
| 671 | lower: impl FnOnce(&mut LowerContext<T>, InterfaceType) -> Result<()>, |
| 672 | ) -> Result<()> { |
| 673 | let (options_idx, mut flags, ty, _) = self.abi_info(store.0); |
| 674 | |
| 675 | // Perform the actual lowering, where while this is running the |
| 676 | // component is forbidden from calling imports. |
| 677 | unsafe { |
| 678 | debug_assert!(flags.may_leave()); |
| 679 | flags.set_may_leave(false); |
| 680 | } |
| 681 | let mut cx = LowerContext::new(store.as_context_mut(), options_idx, self.instance); |
| 682 | let param_ty = InterfaceType::Tuple(cx.types[ty].params); |
| 683 | let result = lower(&mut cx, param_ty); |
| 684 | unsafe { flags.set_may_leave(true) }; |
| 685 | result |
| 686 | } |
| 687 | |
| 688 | /// Creates a `LiftContext` using the configuration values with this lifted |
| 689 | /// function. |
no test coverage detected