luaur_analysis/records/
find_refinement_blockers.rs1use crate::records::blocked_type::BlockedType;
2use crate::records::extern_type::ExternType;
3use crate::records::pending_expansion_type::PendingExpansionType;
4use crate::records::type_once_visitor::TypeOnceVisitor;
5use crate::type_aliases::type_id::TypeId;
6use alloc::string::String;
7use core::ptr;
8use luaur_common::records::dense_hash_set::DenseHashSet;
9
10#[derive(Debug, Clone)]
11pub struct FindRefinementBlockers {
12 pub base: TypeOnceVisitor,
13 pub found: DenseHashSet<TypeId>,
14}
15
16impl FindRefinementBlockers {
17 pub fn new() -> Self {
18 Self {
19 base: TypeOnceVisitor::new(String::from("FindRefinementBlockers"), true),
20 found: DenseHashSet::new(ptr::null()),
21 }
22 }
23
24 pub fn visit_blocked_type(&mut self, ty: TypeId, _btv: &BlockedType) -> bool {
25 self.found.insert(ty);
26 false
27 }
28
29 pub fn visit_pending_expansion_type(
30 &mut self,
31 ty: TypeId,
32 _petv: &PendingExpansionType,
33 ) -> bool {
34 self.found.insert(ty);
35 false
36 }
37
38 pub fn visit_extern_type(&mut self, _ty: TypeId, _etv: &ExternType) -> bool {
39 false
40 }
41}