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
use crate::records::subtyping_environment::SubtypingEnvironment;
use crate::type_aliases::type_id::TypeId;

impl SubtypingEnvironment {
    pub fn try_find_substitution(&self, ty: TypeId) -> Option<TypeId> {
        if let Some(it) = self.substitutions.find(&ty) {
            return Some(*it);
        }

        if !self.parent.is_null() {
            return unsafe { (*self.parent).try_find_substitution(ty) };
        }

        None
    }
}