Skip to main content

luaur_analysis/methods/
refinement_arena_proposition_control_flow_graph.rs

1use crate::records::proposition_control_flow_graph::Proposition;
2use crate::records::refinement_arena_control_flow_graph::RefinementArena;
3use crate::type_aliases::def_id_control_flow_graph::DefId;
4use crate::type_aliases::refinement_control_flow_graph::Refinement;
5use crate::type_aliases::refinement_id_control_flow_graph::RefinementId;
6use luaur_common::macros::luau_assert::LUAU_ASSERT;
7
8impl RefinementArena {
9    pub fn proposition_def_id_bool(&mut self, def: DefId, sense: bool) -> RefinementId {
10        let refinement_ptr = self
11            .allocator
12            .allocate(Refinement::Proposition(Proposition {
13                ptr: def,
14                r#type: None,
15                is_typeof: false,
16                sense,
17            }));
18
19        LUAU_ASSERT!(!refinement_ptr.is_null());
20        refinement_ptr
21    }
22}