| 1729 | } |
| 1730 | |
| 1731 | static bool GetFunctionCallCastRanks(HLSLTree* tree, const HLSLFunctionCall* call, const HLSLFunction* function, int* rankBuffer) |
| 1732 | { |
| 1733 | if (function == NULL || function->numArguments < call->numArguments) { |
| 1734 | // Function not viable |
| 1735 | return false; |
| 1736 | } |
| 1737 | |
| 1738 | const HLSLExpression* expression = call->argument; |
| 1739 | const HLSLArgument* argument = function->argument; |
| 1740 | |
| 1741 | for (int i = 0; i < call->numArguments; ++i) { |
| 1742 | int rank = GetTypeCastRank(tree, expression->expressionType, argument->type); |
| 1743 | if (rank == -1) { |
| 1744 | return false; |
| 1745 | } |
| 1746 | |
| 1747 | rankBuffer[i] = rank; |
| 1748 | |
| 1749 | argument = argument->nextArgument; |
| 1750 | expression = expression->nextExpression; |
| 1751 | } |
| 1752 | |
| 1753 | for (int i = call->numArguments; i < function->numArguments; ++i) { |
| 1754 | if (argument->defaultValue == NULL) { |
| 1755 | // Function not viable. |
| 1756 | return false; |
| 1757 | } |
| 1758 | } |
| 1759 | |
| 1760 | return true; |
| 1761 | } |
| 1762 | |
| 1763 | struct CompareRanks { |
| 1764 | bool operator()(const int& rank1, const int& rank2) { return rank1 > rank2; } |
no test coverage detected