Skip to main content

luaur_analysis/methods/
unifier_make_child_unifier.rs

1use crate::records::txn_log::TxnLog;
2use crate::records::unifier::Unifier;
3use alloc::boxed::Box;
4use alloc::vec::Vec;
5use luaur_common::records::dense_hash_map::DenseHashMap;
6
7impl Unifier {
8    pub fn unifier_make_child_unifier(&mut self) -> Box<Unifier> {
9        let parent_log: *mut TxnLog = &mut self.log;
10
11        let u = Box::new(Unifier {
12            types: self.types,
13            builtin_types: self.builtin_types,
14            normalizer: self.normalizer,
15            scope: self.scope,
16            log: TxnLog {
17                type_var_changes: DenseHashMap::new(core::ptr::null()),
18                type_pack_changes: DenseHashMap::new(core::ptr::null()),
19                parent: parent_log,
20                owned_seen: Vec::new(),
21                shared_seen: self.log.shared_seen,
22                radioactive: false,
23            },
24            failure: false,
25            errors: Vec::new(),
26            location: self.location,
27            variance: self.variance,
28            normalize: self.normalize,
29            check_inhabited: self.check_inhabited,
30            ctx: self.ctx,
31            shared_state: self.shared_state,
32            blocked_types: Vec::new(),
33            blocked_type_packs: Vec::new(),
34            first_pack_error_pos: None,
35        });
36
37        u
38    }
39}