* The index just past the template argument list opening at `code[open]` * (`<`), or -1 when it doesn't close before a `;`, `{` or `}` — then it was a * comparison, not template arguments. Angle brackets inside parentheses don't * count (`Foo `).
(code: string, open: number)
| 804 | * count (`Foo<sizeof(a) < 4>`). |
| 805 | */ |
| 806 | function skipCppAngleArgs(code: string, open: number): number { |
| 807 | let angles = 0; |
| 808 | let parens = 0; |
| 809 | const limit = Math.min(code.length, open + 4000); |
| 810 | for (let i = open; i < limit; i++) { |
| 811 | const c = code[i]; |
| 812 | if (c === '(') parens++; |
| 813 | else if (c === ')') { |
| 814 | if (--parens < 0) return -1; |
| 815 | } else if (c === ';' || c === '{' || c === '}') return -1; |
| 816 | else if (parens === 0 && c === '<') angles++; |
| 817 | else if (parens === 0 && c === '>' && code[i - 1] !== '-') { |
| 818 | if (--angles === 0) return i + 1; |
| 819 | } |
| 820 | } |
| 821 | return -1; |
| 822 | } |
| 823 | |
| 824 | /** |
| 825 | * Blank attribute macros between a pointer or reference and the name it |
no outgoing calls
no test coverage detected