luaur_analyze_cli/methods/
cli_config_resolver_get_config.rs1use crate::records::cli_config_resolver::CliConfigResolver;
2use luaur_analysis::records::config_resolver::ConfigResolver;
3use luaur_analysis::records::type_check_limits::TypeCheckLimits;
4use luaur_cli_lib::functions::get_parent_path::get_parent_path;
5use luaur_config::records::config::Config;
6use luaur_config::type_aliases::module_name::ModuleName;
7
8pub(crate) unsafe fn cli_config_resolver_get_config_thunk(
13 this: *const ConfigResolver,
14 name: *const ModuleName,
15 limits: *const TypeCheckLimits,
16) -> *const Config {
17 let this = this as *const CliConfigResolver;
18 (*this).get_config(&*name, &*limits) as *const Config
19}
20
21impl CliConfigResolver {
22 pub fn get_config(&self, name: &ModuleName, limits: &TypeCheckLimits) -> &Config {
29 let path = match get_parent_path(name) {
32 None => return &self.default_config,
33 Some(path) => path,
34 };
35
36 let this = self as *const CliConfigResolver as *mut CliConfigResolver;
38 unsafe { (*this).read_config_rec(&path, limits) }
39 }
40}