()
| 7777 | } |
| 7778 | |
| 7779 | function parseSwitchStatement() { |
| 7780 | var discriminant, cases, clause, oldInSwitch, defaultFound, marker = markerCreate(); |
| 7781 | |
| 7782 | expectKeyword('switch'); |
| 7783 | |
| 7784 | expect('('); |
| 7785 | |
| 7786 | discriminant = parseExpression(); |
| 7787 | |
| 7788 | expect(')'); |
| 7789 | |
| 7790 | expect('{'); |
| 7791 | |
| 7792 | cases = []; |
| 7793 | |
| 7794 | if (match('}')) { |
| 7795 | lex(); |
| 7796 | return markerApply(marker, delegate.createSwitchStatement(discriminant, cases)); |
| 7797 | } |
| 7798 | |
| 7799 | oldInSwitch = state.inSwitch; |
| 7800 | state.inSwitch = true; |
| 7801 | defaultFound = false; |
| 7802 | |
| 7803 | while (index < length) { |
| 7804 | if (match('}')) { |
| 7805 | break; |
| 7806 | } |
| 7807 | clause = parseSwitchCase(); |
| 7808 | if (clause.test === null) { |
| 7809 | if (defaultFound) { |
| 7810 | throwError({}, Messages.MultipleDefaultsInSwitch); |
| 7811 | } |
| 7812 | defaultFound = true; |
| 7813 | } |
| 7814 | cases.push(clause); |
| 7815 | } |
| 7816 | |
| 7817 | state.inSwitch = oldInSwitch; |
| 7818 | |
| 7819 | expect('}'); |
| 7820 | |
| 7821 | return markerApply(marker, delegate.createSwitchStatement(discriminant, cases)); |
| 7822 | } |
| 7823 | |
| 7824 | // 12.13 The throw statement |
| 7825 |
no test coverage detected