* The qualified name starting at `i` that an argument list follows * (`Descriptor::file(`, `internal::ExtensionSet::Has(`, `Box ::get(`, * `Matrix::operator()(`): its segments and the offset of the `(`. Null when no * such name starts there, or it has no `::`.
(text: string, i: number)
| 222 | * such name starts there, or it has no `::`. |
| 223 | */ |
| 224 | function qualifiedCallableAt(text: string, i: number): { segments: string[]; open: number } | null { |
| 225 | const segments: string[] = []; |
| 226 | let j = i; |
| 227 | if (text.startsWith('::', j)) j = skipBlank(text, j + 2); |
| 228 | for (;;) { |
| 229 | if (text.startsWith('operator', j) && !isWordChar(text.charCodeAt(j + 8))) { |
| 230 | const op = /^operator\s*(\(\s*\)|\[\s*\]|[^\s\w(]+|\w+)\s*\(/.exec(text.slice(j)); |
| 231 | if (!op || segments.length === 0) return null; |
| 232 | segments.push(`operator${op[1]!.replace(/\s+/g, '')}`); |
| 233 | return { segments, open: j + op[0].length - 1 }; |
| 234 | } |
| 235 | const tilde = text[j] === '~'; |
| 236 | const end = wordEnd(text, tilde ? skipBlank(text, j + 1) : j); |
| 237 | if (end < 0) return null; |
| 238 | const word = text.slice(tilde ? skipBlank(text, j + 1) : j, end); |
| 239 | segments.push(tilde ? `~${word}` : word); |
| 240 | let k = skipBlank(text, end); |
| 241 | if (text[k] === '<' && !tilde) { |
| 242 | const close = matching(text, k, '<', '>'); |
| 243 | if (close < 0) return null; |
| 244 | segments[segments.length - 1] += text.slice(k, close + 1); |
| 245 | k = skipBlank(text, close + 1); |
| 246 | } |
| 247 | if (text.startsWith('::', k)) { |
| 248 | if (tilde) return null; |
| 249 | j = skipBlank(text, k + 2); |
| 250 | continue; |
| 251 | } |
| 252 | return text[k] === '(' && segments.length > 1 ? { segments, open: k } : null; |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * After a definition's parameter list (from `i`): the offset of its body's |
no test coverage detected