use crate::records::cli_config_resolver::CliConfigResolver;
use luaur_analysis::records::config_resolver::ConfigResolver;
use luaur_analysis::records::type_check_limits::TypeCheckLimits;
use luaur_cli_lib::functions::get_parent_path::get_parent_path;
use luaur_config::records::config::Config;
use luaur_config::type_aliases::module_name::ModuleName;
pub(crate) unsafe fn cli_config_resolver_get_config_thunk(
this: *const ConfigResolver,
name: *const ModuleName,
limits: *const TypeCheckLimits,
) -> *const Config {
let this = this as *const CliConfigResolver;
(*this).get_config(&*name, &*limits) as *const Config
}
impl CliConfigResolver {
pub fn get_config(&self, name: &ModuleName, limits: &TypeCheckLimits) -> &Config {
let path = match get_parent_path(name) {
None => return &self.default_config,
Some(path) => path,
};
let this = self as *const CliConfigResolver as *mut CliConfigResolver;
unsafe { (*this).read_config_rec(&path, limits) }
}
}