Split a top-level comma list, respecting nested () [] {}.
(args: string)
| 1913 | } |
| 1914 | /** Split a top-level comma list, respecting nested () [] {}. */ |
| 1915 | function goSplitArgs(args: string): string[] { |
| 1916 | const out: string[] = []; |
| 1917 | let depth = 0, cur = ''; |
| 1918 | for (const c of args) { |
| 1919 | if (c === '(' || c === '[' || c === '{') { depth++; cur += c; } |
| 1920 | else if (c === ')' || c === ']' || c === '}') { depth--; cur += c; } |
| 1921 | else if (c === ',' && depth === 0) { out.push(cur); cur = ''; } |
| 1922 | else cur += c; |
| 1923 | } |
| 1924 | if (cur.trim()) out.push(cur); |
| 1925 | return out; |
| 1926 | } |
| 1927 | /** Tail ident of a handler arg: `gin.Logger()`→`Logger`, `mw`→`mw`; null for string paths / closures. */ |
| 1928 | function goHandlerIdent(expr: string): string | null { |
| 1929 | const cleaned = expr.trim().replace(/\(\s*\)$/, ''); // drop a trailing call () |
no outgoing calls
no test coverage detected