Skip to main content

luaur_analysis/methods/
dfg_scope_lookup_data_flow_graph.rs

1use crate::records::dfg_scope::DfgScope;
2use crate::records::symbol::Symbol;
3use crate::type_aliases::def_id_def::DefId;
4
5impl DfgScope {
6    pub fn lookup_symbol(&self, symbol: Symbol) -> Option<DefId> {
7        let mut current = self as *const DfgScope;
8        unsafe {
9            while !current.is_null() {
10                if let Some(def) = (*current).bindings.find(&symbol) {
11                    return Some(*def);
12                }
13
14                current = (*current).parent as *const DfgScope;
15            }
16        }
17
18        None
19    }
20}