MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _AR_EXP_ValidateInvocation

Function _AR_EXP_ValidateInvocation

src/arithmetic/arithmetic_expression.c:410–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410static 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.

Callers 1

Calls 2

array_lenFunction · 0.85
Error_SITypeMismatchFunction · 0.85

Tested by

no test coverage detected