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
use crate::functions::get_type_pack::get;
use crate::records::blocked_type_pack::BlockedTypePack;
use crate::records::constraint::Constraint;
use crate::type_aliases::type_pack_id::TypePackId;
use luaur_common::macros::luau_assert::LUAU_ASSERT;

pub fn can_mutate(tp: TypePackId, constraint: *const Constraint) -> bool {
    if let Some(blocked) = unsafe { get::<BlockedTypePack>(tp).as_ref() } {
        let owner = blocked.owner;
        LUAU_ASSERT!(!owner.is_null());
        return owner == constraint as *mut Constraint;
    }

    true
}