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::functions::make_union::make_union;
use crate::records::builtin_types::BuiltinTypes;
use crate::records::type_arena::TypeArena;
use crate::type_aliases::type_id::TypeId;
use core::ptr::NonNull;
use luaur_common::macros::luau_assert::LUAU_ASSERT;

pub fn make_option(
    builtin_types: NonNull<BuiltinTypes>,
    arena: &mut TypeArena,
    t: TypeId,
) -> TypeId {
    LUAU_ASSERT!(!t.is_null());
    let builtin_types = unsafe { builtin_types.as_ref() };
    make_union(arena, vec![builtin_types.nilType, t])
}