(from: number, to: number, kind: 'param' | 'closure', scopeFrom: number, scopeTo: number)
| 533 | }; |
| 534 | // A parameter `pattern: Type`, or a closure's `pattern`. |
| 535 | const param = (from: number, to: number, kind: 'param' | 'closure', scopeFrom: number, scopeTo: number): void => { |
| 536 | const colon = topColon(code, from, to, close); |
| 537 | const pattern = code.slice(from, colon < 0 ? to : colon); |
| 538 | const simple = /^\s*(?:mut\s+)?([A-Za-z_]\w*)\s*$/.exec(pattern); |
| 539 | if (simple) { |
| 540 | if (isBindingName(simple[1]!)) { |
| 541 | add(simple[1]!, { |
| 542 | at: from + pattern.lastIndexOf(simple[1]!), kind, from: scopeFrom, to: scopeTo, |
| 543 | type: colon < 0 ? undefined : code.slice(colon + 1, to).trim(), |
| 544 | }); |
| 545 | } |
| 546 | return; |
| 547 | } |
| 548 | bindPattern(from, colon < 0 ? to : colon, kind, scopeFrom, scopeTo); |
| 549 | }; |
| 550 | |
| 551 | for (const f of scopes.fns) { |
| 552 | for (const [a, b] of splitTop(code, f.from + 1, f.paramsEnd, close, true)) param(a, b, 'param', f.body, f.to); |
no test coverage detected