File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,16 @@ impl Function for And {
3434
3535 fn invoke ( & self , args : & [ Value ] , _context : & Context ) -> Result < Value , DscError > {
3636 debug ! ( "{}" , t!( "functions.and.invoked" ) ) ;
37- let mut result = true ;
3837 for arg in args {
3938 if let Some ( value) = arg. as_bool ( ) {
40- result &= value;
39+ if !value {
40+ return Ok ( Value :: Bool ( false ) ) ;
41+ }
4142 } else {
4243 return Err ( DscError :: Parser ( t ! ( "functions.invalidArguments" ) . to_string ( ) ) ) ;
4344 }
4445 }
45- Ok ( Value :: Bool ( result ) )
46+ Ok ( Value :: Bool ( true ) )
4647 }
4748}
4849
Original file line number Diff line number Diff line change @@ -34,15 +34,16 @@ impl Function for Or {
3434
3535 fn invoke ( & self , args : & [ Value ] , _context : & Context ) -> Result < Value , DscError > {
3636 debug ! ( "{}" , t!( "functions.or.invoked" ) ) ;
37- let mut result = false ;
3837 for arg in args {
3938 if let Some ( value) = arg. as_bool ( ) {
40- result |= value;
39+ if value {
40+ return Ok ( Value :: Bool ( true ) ) ;
41+ }
4142 } else {
4243 return Err ( DscError :: Parser ( t ! ( "functions.invalidArguments" ) . to_string ( ) ) ) ;
4344 }
4445 }
45- Ok ( Value :: Bool ( result ) )
46+ Ok ( Value :: Bool ( false ) )
4647 }
4748}
4849
You can’t perform that action at this time.
0 commit comments