MCPcopy Index your code
hub / github.com/reactjs/react-rails / parseSwitchStatement

Function parseSwitchStatement

lib/assets/javascripts/JSXTransformer.js:7779–7822  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

parseStatementFunction · 0.85

Calls 9

markerCreateFunction · 0.85
expectKeywordFunction · 0.85
expectFunction · 0.85
parseExpressionFunction · 0.85
matchFunction · 0.85
lexFunction · 0.85
markerApplyFunction · 0.85
parseSwitchCaseFunction · 0.85
throwErrorFunction · 0.85

Tested by

no test coverage detected