use core::sync::atomic::Ordering;
use luaur_common::functions::is_analysis_flag_experimental::isAnalysisFlagExperimental;
use luaur_common::records::f_value::{FValue, FValueList};
pub fn set_luau_flags_default() {
let mut flag_ptr = <bool as FValueList>::head().load(Ordering::Relaxed);
while !flag_ptr.is_null() {
let flag = unsafe { &*flag_ptr };
#[repr(C)]
struct FValueLayout<T> {
value: core::cell::UnsafeCell<T>,
dynamic: bool,
name: *const core::ffi::c_char,
next: core::cell::UnsafeCell<*const FValue<T>>,
}
let layout = unsafe { &*(flag_ptr as *const FValueLayout<bool>) };
let name_ptr = layout.name;
if !name_ptr.is_null() {
let name_cstr = unsafe { core::ffi::CStr::from_ptr(name_ptr) };
let name_bytes = name_cstr.to_bytes();
if name_bytes.starts_with(b"Luau") && !isAnalysisFlagExperimental(name_ptr) {
flag.set(true);
}
}
flag_ptr = unsafe { *layout.next.get() as *mut FValue<bool> };
}
}