()
| 2445 | // https://tc39.github.io/ecma262/#sec-switch-statement |
| 2446 | |
| 2447 | parseSwitchCase(): Node.SwitchCase { |
| 2448 | const node = this.createNode(); |
| 2449 | |
| 2450 | let test; |
| 2451 | if (this.matchKeyword('default')) { |
| 2452 | this.nextToken(); |
| 2453 | test = null; |
| 2454 | } else { |
| 2455 | this.expectKeyword('case'); |
| 2456 | test = this.parseExpression(); |
| 2457 | } |
| 2458 | this.expect(':'); |
| 2459 | |
| 2460 | const consequent: Node.StatementListItem[] = []; |
| 2461 | while (true) { |
| 2462 | if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) { |
| 2463 | break; |
| 2464 | } |
| 2465 | consequent.push(this.parseStatementListItem()); |
| 2466 | } |
| 2467 | |
| 2468 | return this.finalize(node, new Node.SwitchCase(test, consequent)); |
| 2469 | } |
| 2470 | |
| 2471 | parseSwitchStatement(): Node.SwitchStatement { |
| 2472 | const node = this.createNode(); |
no test coverage detected