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
use crate::records::field::Field;
use crate::records::symbol::Symbol;
use crate::type_aliases::l_value::{LValue, LValueMember};
use alloc::sync::Arc;

pub fn baseof(lvalue: &LValue) -> *const LValue {
    if let Some(field) = <Field as LValueMember>::get_if(lvalue) {
        return match &field.parent {
            Some(parent) => Arc::as_ptr(parent),
            None => core::ptr::null(),
        };
    }

    let symbol = <Symbol as LValueMember>::get_if(lvalue);
    debug_assert!(symbol.is_some());
    core::ptr::null() // Base of root is null.
}