luaur_analysis/methods/
refinement_arena_proposition_refinement.rs1use crate::records::proposition_refinement::Proposition;
2use crate::records::refinement_arena_refinement::RefinementArena;
3use crate::records::refinement_key::RefinementKey;
4use crate::records::typed_allocator::TypedAllocator;
5use crate::type_aliases::refinement_id_refinement::RefinementId;
6use crate::type_aliases::refinement_refinement::Refinement;
7use crate::type_aliases::type_id::TypeId;
8use luaur_common::macros::luau_assert::LUAU_ASSERT;
9
10impl RefinementArena {
11 pub fn proposition_refinement_key_type_id(
12 &mut self,
13 key: *const RefinementKey,
14 discriminant_ty: TypeId,
15 ) -> RefinementId {
16 if key.is_null() {
17 return core::ptr::null_mut();
18 }
19
20 let refinement_ptr = self
21 .allocator
22 .allocate(Refinement::Proposition(Proposition {
23 key,
24 discriminantTy: discriminant_ty,
25 implicitFromCall: false,
26 }));
27
28 LUAU_ASSERT!(!refinement_ptr.is_null());
29 refinement_ptr
30 }
31}