Skip to main content

luaur_analysis/functions/
contains_subscripted_definition.rs

1use crate::functions::get_def::get_def_id;
2use crate::records::cell::Cell;
3use crate::records::phi::Phi;
4use crate::type_aliases::def_id_def::DefId;
5
6pub fn contains_subscripted_definition(def: DefId) -> bool {
7    unsafe {
8        let cell_ptr = get_def_id::<Cell>(def);
9        if !cell_ptr.is_null() {
10            return (*cell_ptr).subscripted;
11        }
12
13        let phi_ptr = get_def_id::<Phi>(def);
14        if !phi_ptr.is_null() {
15            let phi = &*phi_ptr;
16            for &operand in &phi.operands {
17                if contains_subscripted_definition(operand) {
18                    return true;
19                }
20            }
21        }
22    }
23
24    false
25}