luaur_analyze_cli/records/file_navigation_context.rs
1use crate::records::luau_config_interrupt_info::LuauConfigInterruptInfo;
2use alloc::boxed::Box;
3use alloc::string::String;
4use luaur_cli_lib::records::vfs_navigator::VfsNavigator;
5
6/// Port of `struct FileNavigationContext : Luau::Require::NavigationContext`
7/// (`CLI/include/Luau/AnalyzeRequirer.h`).
8///
9/// The C++ `: NavigationContext` base relationship is expressed in Rust by
10/// implementing [`luaur_require::records::navigation_context::NavigationContextTrait`]
11/// for this type (see `methods/file_navigation_context_navigation_context_trait.rs`),
12/// rather than by embedding the (non-constructible-from-here) base struct.
13pub struct FileNavigationContext {
14 pub(crate) requirer_path: String,
15 pub(crate) vfs: VfsNavigator,
16 /// Backing storage for the `luauConfigInit` / `luauConfigInterrupt` callbacks
17 /// installed by `CliFileResolver::resolveModule`. In the C++ this is a stack
18 /// local (`LuauConfigInterruptInfo info`) whose address is captured by the
19 /// callbacks; here it is boxed and owned by the context so the captured raw
20 /// pointer stays valid for the duration of `navigate`.
21 pub(crate) interrupt_info: Option<Box<LuauConfigInterruptInfo>>,
22}