Skip to main content

luaur_analysis/methods/
subtyping_environment_try_find_subtyping_result.rs

1use crate::records::subtyping_environment::SubtypingEnvironment;
2use crate::records::subtyping_result::SubtypingResult;
3use crate::type_aliases::type_id::TypeId;
4
5impl SubtypingEnvironment {
6    pub fn try_find_subtyping_result(
7        &self,
8        sub_and_super: (TypeId, TypeId),
9    ) -> Option<&SubtypingResult> {
10        if let Some(it) = self.seen_set_cache.find(&sub_and_super) {
11            return Some(it);
12        }
13
14        if !self.parent.is_null() {
15            return unsafe { (*self.parent).try_find_subtyping_result(sub_and_super) };
16        }
17
18        None
19    }
20}