@@ -189,14 +189,6 @@ impl FunctionDispatcher {
189
189
return Err ( DscError :: Parser ( t ! ( "functions.argCountRequired" , name = name, min = min_args, max = max_args) . to_string ( ) ) ) ;
190
190
}
191
191
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
-
200
192
for ( index, value) in args. iter ( ) . enumerate ( ) {
201
193
if index >= metadata. accepted_arg_ordered_types . len ( ) {
202
194
break ;
@@ -206,6 +198,8 @@ impl FunctionDispatcher {
206
198
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 ( ) ) ) ;
207
199
} else if value. is_boolean ( ) && !metadata. accepted_arg_ordered_types [ index] . contains ( & FunctionArgKind :: Boolean ) {
208
200
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 ( ) ) ) ;
209
203
} else if value. is_number ( ) && !metadata. accepted_arg_ordered_types [ index] . contains ( & FunctionArgKind :: Number ) {
210
204
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 ( ) ) ) ;
211
205
} else if value. is_object ( ) && !metadata. accepted_arg_ordered_types [ index] . contains ( & FunctionArgKind :: Object ) {
@@ -222,6 +216,8 @@ impl FunctionDispatcher {
222
216
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 ( ) ) ) ;
223
217
} else if value. is_boolean ( ) && !remaining_arg_types. contains ( & FunctionArgKind :: Boolean ) {
224
218
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 ( ) ) ) ;
225
221
} else if value. is_number ( ) && !remaining_arg_types. contains ( & FunctionArgKind :: Number ) {
226
222
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 ( ) ) ) ;
227
223
} else if value. is_object ( ) && !remaining_arg_types. contains ( & FunctionArgKind :: Object ) {
0 commit comments