* Whether the `(` at `paren` opens a parameter list: an arrow or a body * follows it, and no control-flow keyword precedes it (`if ([a, B].includes(x)) {`).
(code: string, paren: number)
| 2433 | * follows it, and no control-flow keyword precedes it (`if ([a, B].includes(x)) {`). |
| 2434 | */ |
| 2435 | function opensParameters(code: string, paren: number): boolean { |
| 2436 | const p = skipSpace(code, paren - 1, -1); |
| 2437 | if (ID_CHAR.test(code[p] ?? '') && CONTROL_HEADS.has(wordEndingAt(code, p))) return false; |
| 2438 | const close = matchingCloser(code, paren); |
| 2439 | if (close < 0) return false; |
| 2440 | PARAMETERS_END.lastIndex = close + 1; |
| 2441 | return PARAMETERS_END.test(code); |
| 2442 | } |
| 2443 | |
| 2444 | /** Whether a property key ends at the `:` at `colon` and opens its element: `{ key:`, `, 'key':`, `, [key]:`. */ |
| 2445 | function keyOpensElement(code: string, colon: number): boolean { |
no test coverage detected