Skip to main content

luaur_analysis/functions/
baseof.rs

1use crate::records::field::Field;
2use crate::records::symbol::Symbol;
3use crate::type_aliases::l_value::{LValue, LValueMember};
4use alloc::sync::Arc;
5
6pub fn baseof(lvalue: &LValue) -> *const LValue {
7    if let Some(field) = <Field as LValueMember>::get_if(lvalue) {
8        return match &field.parent {
9            Some(parent) => Arc::as_ptr(parent),
10            None => core::ptr::null(),
11        };
12    }
13
14    let symbol = <Symbol as LValueMember>::get_if(lvalue);
15    debug_assert!(symbol.is_some());
16    core::ptr::null() // Base of root is null.
17}