| 408 | } |
| 409 | |
| 410 | static bool _AR_EXP_ValidateInvocation |
| 411 | ( |
| 412 | AR_FuncDesc *fdesc, |
| 413 | SIValue *argv, |
| 414 | uint argc |
| 415 | ) { |
| 416 | SIType actual_type; |
| 417 | SIType expected_type = T_NULL; |
| 418 | |
| 419 | uint expected_types_count = array_len(fdesc->types); |
| 420 | for(int i = 0; i < argc; i++) { |
| 421 | actual_type = SI_TYPE(argv[i]); |
| 422 | /* For a function that accepts a variable number of arguments. |
| 423 | * the last specified type in fdesc->types is repeatable. */ |
| 424 | if(i < expected_types_count) { |
| 425 | expected_type = fdesc->types[i]; |
| 426 | } |
| 427 | if(!(actual_type & expected_type)) { |
| 428 | Error_SITypeMismatch(argv[i], expected_type); |
| 429 | return false; |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | return true; |
| 434 | } |
| 435 | |
| 436 | /* Evaluating an expression tree constructs an array of SIValues. |
| 437 | * Free all of these values, in case an intermediate node on the tree caused a heap allocation. |
no test coverage detected