@@ -189,14 +189,6 @@ impl FunctionDispatcher {
189189 return Err ( DscError :: Parser ( t ! ( "functions.argCountRequired" , name = name, min = min_args, max = max_args) . to_string ( ) ) ) ;
190190 }
191191
192- // iterate over the args and check if they match the order of accepted_arg_types, any remaining args must match the remaining_arg_types
193- if args. len ( ) < metadata. accepted_arg_ordered_types . len ( ) {
194- return Err ( DscError :: Parser ( t ! ( "functions.tooFewArgs" , name = name, count = metadata. accepted_arg_ordered_types. len( ) ) . to_string ( ) ) ) ;
195- }
196- if args. len ( ) > metadata. accepted_arg_ordered_types . len ( ) && metadata. remaining_arg_accepted_types . is_none ( ) {
197- return Err ( DscError :: Parser ( t ! ( "functions.tooManyArgs" , name = name, count = metadata. accepted_arg_ordered_types. len( ) ) . to_string ( ) ) ) ;
198- }
199-
200192 for ( index, value) in args. iter ( ) . enumerate ( ) {
201193 if index >= metadata. accepted_arg_ordered_types . len ( ) {
202194 break ;
@@ -206,6 +198,8 @@ impl FunctionDispatcher {
206198 return Err ( DscError :: Parser ( t ! ( "functions.noArrayArgs" , name = name, accepted_args_string = metadata. accepted_arg_ordered_types[ index] . iter( ) . map( std:: string:: ToString :: to_string) . collect:: <Vec <_>>( ) . join( ", " ) ) . to_string ( ) ) ) ;
207199 } else if value. is_boolean ( ) && !metadata. accepted_arg_ordered_types [ index] . contains ( & FunctionArgKind :: Boolean ) {
208200 return Err ( DscError :: Parser ( t ! ( "functions.noBooleanArgs" , name = name, accepted_args_string = metadata. accepted_arg_ordered_types[ index] . iter( ) . map( std:: string:: ToString :: to_string) . collect:: <Vec <_>>( ) . join( ", " ) ) . to_string ( ) ) ) ;
201+ } else if value. is_null ( ) && !metadata. accepted_arg_ordered_types [ index] . contains ( & FunctionArgKind :: Null ) {
202+ return Err ( DscError :: Parser ( t ! ( "functions.noNullArgs" , name = name, accepted_args_string = metadata. accepted_arg_ordered_types[ index] . iter( ) . map( std:: string:: ToString :: to_string) . collect:: <Vec <_>>( ) . join( ", " ) ) . to_string ( ) ) ) ;
209203 } else if value. is_number ( ) && !metadata. accepted_arg_ordered_types [ index] . contains ( & FunctionArgKind :: Number ) {
210204 return Err ( DscError :: Parser ( t ! ( "functions.noNumberArgs" , name = name, accepted_args_string = metadata. accepted_arg_ordered_types[ index] . iter( ) . map( std:: string:: ToString :: to_string) . collect:: <Vec <_>>( ) . join( ", " ) ) . to_string ( ) ) ) ;
211205 } else if value. is_object ( ) && !metadata. accepted_arg_ordered_types [ index] . contains ( & FunctionArgKind :: Object ) {
@@ -222,6 +216,8 @@ impl FunctionDispatcher {
222216 return Err ( DscError :: Parser ( t ! ( "functions.noArrayArgs" , name = name, accepted_args_string = remaining_arg_types. iter( ) . map( std:: string:: ToString :: to_string) . collect:: <Vec <_>>( ) . join( ", " ) ) . to_string ( ) ) ) ;
223217 } else if value. is_boolean ( ) && !remaining_arg_types. contains ( & FunctionArgKind :: Boolean ) {
224218 return Err ( DscError :: Parser ( t ! ( "functions.noBooleanArgs" , name = name, accepted_args_string = remaining_arg_types. iter( ) . map( std:: string:: ToString :: to_string) . collect:: <Vec <_>>( ) . join( ", " ) ) . to_string ( ) ) ) ;
219+ } else if value. is_null ( ) && !remaining_arg_types. contains ( & FunctionArgKind :: Null ) {
220+ return Err ( DscError :: Parser ( t ! ( "functions.noNullArgs" , name = name, accepted_args_string = remaining_arg_types. iter( ) . map( std:: string:: ToString :: to_string) . collect:: <Vec <_>>( ) . join( ", " ) ) . to_string ( ) ) ) ;
225221 } else if value. is_number ( ) && !remaining_arg_types. contains ( & FunctionArgKind :: Number ) {
226222 return Err ( DscError :: Parser ( t ! ( "functions.noNumberArgs" , name = name, accepted_args_string = remaining_arg_types. iter( ) . map( std:: string:: ToString :: to_string) . collect:: <Vec <_>>( ) . join( ", " ) ) . to_string ( ) ) ) ;
227223 } else if value. is_object ( ) && !remaining_arg_types. contains ( & FunctionArgKind :: Object ) {
0 commit comments