MCPcopy Create free account
hub / github.com/boostorg/build / argument_list_check

Function argument_list_check

src/engine/function.cpp:3253–3316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3251}
3252
3253void argument_list_check( struct arg_list * formal, int32_t formal_count,
3254 FUNCTION * function, FRAME * frame )
3255{
3256 LOL * all_actual = frame->args;
3257 int32_t i;
3258
3259 for ( i = 0; i < formal_count; ++i )
3260 {
3261 LIST * actual = lol_get( all_actual, i );
3262 LISTITER actual_iter = list_begin( actual );
3263 LISTITER const actual_end = list_end( actual );
3264 int32_t j;
3265 for ( j = 0; j < formal[ i ].size; ++j )
3266 {
3267 struct argument * formal_arg = &formal[ i ].args[ j ];
3268
3269 switch ( formal_arg->flags )
3270 {
3271 case ARG_ONE:
3272 if ( actual_iter == actual_end )
3273 argument_error( "missing argument", function, frame,
3274 formal_arg->arg_name );
3275 type_check_range( formal_arg->type_name, actual_iter,
3276 list_next( actual_iter ), frame, function,
3277 formal_arg->arg_name );
3278 actual_iter = list_next( actual_iter );
3279 break;
3280 case ARG_OPTIONAL:
3281 if ( actual_iter != actual_end )
3282 {
3283 type_check_range( formal_arg->type_name, actual_iter,
3284 list_next( actual_iter ), frame, function,
3285 formal_arg->arg_name );
3286 actual_iter = list_next( actual_iter );
3287 }
3288 break;
3289 case ARG_PLUS:
3290 if ( actual_iter == actual_end )
3291 argument_error( "missing argument", function, frame,
3292 formal_arg->arg_name );
3293 /* fallthrough */
3294 case ARG_STAR:
3295 type_check_range( formal_arg->type_name, actual_iter,
3296 actual_end, frame, function, formal_arg->arg_name );
3297 actual_iter = actual_end;
3298 break;
3299 case ARG_VARIADIC:
3300 return;
3301 }
3302 }
3303
3304 if ( actual_iter != actual_end )
3305 argument_error( "extra argument", function, frame, list_item(
3306 actual_iter ) );
3307 }
3308
3309 for ( ; i < all_actual->count; ++i )
3310 {

Callers 1

function_runFunction · 0.85

Calls 5

lol_getFunction · 0.85
list_beginFunction · 0.85
list_endFunction · 0.85
argument_errorFunction · 0.85
type_check_rangeFunction · 0.85

Tested by

no test coverage detected