| 66 | } |
| 67 | |
| 68 | static int findArgumentPosRecursive(const Token* tok, const Token* tokToFind, bool &found, nonneg int depth=0) |
| 69 | { |
| 70 | ++depth; |
| 71 | if (!tok || depth >= 100) |
| 72 | return -1; |
| 73 | if (tok->str() == ",") { |
| 74 | int res = findArgumentPosRecursive(tok->astOperand1(), tokToFind, found, depth); |
| 75 | if (res == -1) |
| 76 | return -1; |
| 77 | if (found) |
| 78 | return res; |
| 79 | const int argn = res; |
| 80 | res = findArgumentPosRecursive(tok->astOperand2(), tokToFind, found, depth); |
| 81 | if (res == -1) |
| 82 | return -1; |
| 83 | return argn + res; |
| 84 | } |
| 85 | if (tokToFind == tok) |
| 86 | found = true; |
| 87 | return 1; |
| 88 | } |
| 89 | |
| 90 | static int findArgumentPos(const Token* tok, const Token* tokToFind){ |
| 91 | bool found = false; |
no test coverage detected