@@ -56,6 +56,7 @@ use crate::evaluator::{
5656 Arity , Environment , NumIter , StringIter , ValueIter , eval_and, eval_define, eval_if,
5757 eval_lambda, eval_or, eval_quote,
5858} ;
59+ #[ cfg( any( feature = "scheme" , feature = "jsonlogic" , test) ) ]
5960use std:: collections:: HashMap ;
6061use std:: sync:: { Arc , LazyLock } ;
6162
@@ -112,12 +113,13 @@ impl PartialEq for BuiltinOp {
112113
113114impl BuiltinOp {
114115 /// Check if this operation is a special form
115- #[ cfg_attr ( not ( test) , expect ( dead_code ) ) ]
116+ #[ cfg ( test) ]
116117 pub ( crate ) fn is_special_form ( & self ) -> bool {
117118 matches ! ( self . op_kind, OpKind :: SpecialForm ( _) )
118119 }
119120
120121 /// Check if the given number of arguments is valid for this operation
122+ #[ cfg( any( feature = "scheme" , feature = "jsonlogic" ) ) ]
121123 pub ( crate ) fn validate_arity ( & self , arg_count : usize ) -> Result < ( ) , Error > {
122124 self . arity . validate ( arg_count)
123125 }
@@ -518,12 +520,14 @@ static BUILTIN_OPS: LazyLock<Vec<BuiltinOp>> = LazyLock::new(|| {
518520} ) ;
519521
520522/// Lazy static map from scheme_id to BuiltinOp (private - use find_builtin_op_by_scheme_id)
523+ #[ cfg( any( feature = "scheme" , feature = "jsonlogic" , test) ) ]
521524static BUILTIN_SCHEME : LazyLock < HashMap < & ' static str , & ' static BuiltinOp > > = LazyLock :: new ( || {
522525 let ops: & ' static [ BuiltinOp ] = BUILTIN_OPS . as_slice ( ) ;
523526 ops. iter ( ) . map ( |op| ( op. scheme_id , op) ) . collect ( )
524527} ) ;
525528
526529/// Lazy static map from jsonlogic_id to BuiltinOp (private - use find_builtin_op_by_jsonlogic_id)
530+ #[ cfg( any( feature = "jsonlogic" , test) ) ]
527531static BUILTIN_JSONLOGIC : LazyLock < HashMap < & ' static str , & ' static BuiltinOp > > =
528532 LazyLock :: new ( || {
529533 let ops: & ' static [ BuiltinOp ] = BUILTIN_OPS . as_slice ( ) ;
@@ -536,21 +540,25 @@ pub(crate) fn get_builtin_ops() -> &'static [BuiltinOp] {
536540}
537541
538542/// Find a builtin operation by its Scheme identifier
543+ #[ cfg( any( feature = "scheme" , feature = "jsonlogic" , test) ) ]
539544pub ( crate ) fn find_scheme_op ( id : & str ) -> Option < & ' static BuiltinOp > {
540545 BUILTIN_SCHEME . get ( id) . copied ( )
541546}
542547
543548/// Find a builtin operation by its JSONLogic identifier
549+ #[ cfg( any( feature = "jsonlogic" , test) ) ]
544550pub ( crate ) fn find_jsonlogic_op ( id : & str ) -> Option < & ' static BuiltinOp > {
545551 BUILTIN_JSONLOGIC . get ( id) . copied ( )
546552}
547553
548554/// Get the quote builtin operation - guaranteed to exist
555+ #[ cfg( any( feature = "scheme" , feature = "jsonlogic" ) ) ]
549556pub ( crate ) fn get_quote_op ( ) -> & ' static BuiltinOp {
550557 find_scheme_op ( "quote" ) . expect ( "quote builtin operation must be available" )
551558}
552559
553560/// Get the list builtin operation - guaranteed to exist
561+ #[ cfg( feature = "jsonlogic" ) ]
554562pub ( crate ) fn get_list_op ( ) -> & ' static BuiltinOp {
555563 find_scheme_op ( "list" ) . expect ( "list builtin operation must be available" )
556564}
0 commit comments