@@ -63,6 +63,14 @@ impl Default for Engine {
6363 }
6464}
6565
66+ /// Bundled artifacts used by the type analyzer when operating on an engine.
67+ pub ( crate ) type TypeAnalysisContext = (
68+ Rc < Vec < Ref < Module > > > ,
69+ Option < Rc < crate :: scheduler:: Schedule > > ,
70+ Option < Rc < crate :: compiler:: hoist:: HoistedLoopsLookup > > ,
71+ Rc < CompiledPolicyData > ,
72+ ) ;
73+
6674impl Engine {
6775 /// Create an instance of [Engine].
6876 pub fn new ( ) -> Self {
@@ -1613,14 +1621,7 @@ impl Engine {
16131621 /// Get the context needed for type analysis.
16141622 /// Returns (modules, schedule, loop_lookup, compiled_policy) for use by TypeAnalyzer.
16151623 /// The engine will prepare itself if needed. Returns None if preparation fails.
1616- pub ( crate ) fn get_type_analysis_context (
1617- & mut self ,
1618- ) -> Option < (
1619- Rc < Vec < Ref < Module > > > ,
1620- Option < Rc < crate :: scheduler:: Schedule > > ,
1621- Option < Rc < crate :: compiler:: hoist:: HoistedLoopsLookup > > ,
1622- Rc < CompiledPolicyData > ,
1623- ) > {
1624+ pub ( crate ) fn get_type_analysis_context ( & mut self ) -> Option < TypeAnalysisContext > {
16241625 if self . prepare_for_eval ( false , false ) . is_err ( ) {
16251626 return None ;
16261627 }
@@ -1641,7 +1642,7 @@ impl Engine {
16411642 rule_path : & str ,
16421643 ) -> Option < crate :: value:: Value > {
16431644 // Prepare the engine if not already prepared
1644- if let Err ( _ ) = self . prepare_for_eval ( false , false ) {
1645+ if self . prepare_for_eval ( false , false ) . is_err ( ) {
16451646 return None ;
16461647 }
16471648
0 commit comments