Skip to main content

luaur_analysis/methods/
constraint_generator_run_on_fragment.rs

1use crate::records::constraint_generator::ConstraintGenerator;
2use crate::records::constraint_set::ConstraintSet;
3use crate::type_aliases::scope_ptr_constraint_generator::ScopePtr;
4use luaur_ast::records::ast_stat_block::AstStatBlock;
5
6impl ConstraintGenerator {
7    pub fn run_on_fragment(
8        &mut self,
9        resume_scope: &ScopePtr,
10        block: *mut AstStatBlock,
11    ) -> ConstraintSet {
12        self.visit_fragment_root(resume_scope, block);
13
14        ConstraintSet {
15            root_scope: self.root_scope,
16            constraints: self.constraints.clone(),
17            free_types: self.free_types.clone(),
18            scope_to_function: self.scope_to_function.clone(),
19            errors: self.errors.clone(),
20        }
21    }
22}