luaur-analysis 0.1.3

Luau type checker and type inference (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::functions::baseof::baseof;
use crate::records::field::Field;
use crate::records::symbol::Symbol;
use crate::type_aliases::l_value::{LValue, LValueMember};

pub fn get_base_symbol(lvalue: &LValue) -> Symbol {
    let mut current: *const LValue = lvalue;

    unsafe {
        while <Field as LValueMember>::get_if(&*current).is_some() {
            current = baseof(&*current);
        }

        let symbol = <Symbol as LValueMember>::get_if(&*current);
        debug_assert!(symbol.is_some());
        symbol.unwrap().clone()
    }
}