()
| 2565 | // https://tc39.github.io/ecma262/#sec-try-statement |
| 2566 | |
| 2567 | parseCatchClause(): Node.CatchClause { |
| 2568 | const node = this.createNode(); |
| 2569 | |
| 2570 | this.expectKeyword('catch'); |
| 2571 | |
| 2572 | this.expect('('); |
| 2573 | if (this.match(')')) { |
| 2574 | this.throwUnexpectedToken(this.lookahead); |
| 2575 | } |
| 2576 | |
| 2577 | const params: any[] = []; |
| 2578 | const param = this.parsePattern(params); |
| 2579 | const paramMap = {}; |
| 2580 | for (let i = 0; i < params.length; i++) { |
| 2581 | const key = '$' + params[i].value; |
| 2582 | if (Object.prototype.hasOwnProperty.call(paramMap, key)) { |
| 2583 | this.tolerateError(Messages.DuplicateBinding, params[i].value); |
| 2584 | } |
| 2585 | paramMap[key] = true; |
| 2586 | } |
| 2587 | |
| 2588 | if (this.context.strict && param.type === Syntax.Identifier) { |
| 2589 | if (this.scanner.isRestrictedWord((param as Node.Identifier).name)) { |
| 2590 | this.tolerateError(Messages.StrictCatchVariable); |
| 2591 | } |
| 2592 | } |
| 2593 | |
| 2594 | this.expect(')'); |
| 2595 | const body = this.parseBlock(); |
| 2596 | |
| 2597 | return this.finalize(node, new Node.CatchClause(param, body)); |
| 2598 | } |
| 2599 | |
| 2600 | parseFinallyClause(): Node.BlockStatement { |
| 2601 | this.expectKeyword('finally'); |
no test coverage detected