Creates a new lowering context from the specified parameters.
(
store: StoreContextMut<'a, T>,
options: OptionsIndex,
instance: Instance,
)
| 56 | impl<'a, T: 'static> LowerContext<'a, T> { |
| 57 | /// Creates a new lowering context from the specified parameters. |
| 58 | pub fn new( |
| 59 | store: StoreContextMut<'a, T>, |
| 60 | options: OptionsIndex, |
| 61 | instance: Instance, |
| 62 | ) -> LowerContext<'a, T> { |
| 63 | // Debug-assert that if we can't block that blocking is indeed allowed. |
| 64 | // This'll catch when this is accidentally created outside of a fiber |
| 65 | // when we need to be on a fiber. |
| 66 | if cfg!(debug_assertions) && !store.0.can_block() { |
| 67 | store.0.validate_sync_call().unwrap(); |
| 68 | } |
| 69 | let (component, store) = instance.component_and_store_mut(store.0); |
| 70 | LowerContext { |
| 71 | store: StoreContextMut(store), |
| 72 | options, |
| 73 | types: component.types(), |
| 74 | instance, |
| 75 | allow_realloc: true, |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /// Like `new`, except disallows use of `options.realloc`. |
| 80 | /// |
nothing calls this directly
no test coverage detected