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

Function parseFunctionSourceElements

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

Source from the content-addressed store, hash-verified

7994 }
7995
7996 function parseFunctionSourceElements() {
7997 var sourceElement, sourceElements = [], token, directive, firstRestricted,
7998 oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesizedCount,
7999 marker = markerCreate();
8000
8001 expect('{');
8002
8003 while (index < length) {
8004 if (lookahead.type !== Token.StringLiteral) {
8005 break;
8006 }
8007 token = lookahead;
8008
8009 sourceElement = parseSourceElement();
8010 sourceElements.push(sourceElement);
8011 if (sourceElement.expression.type !== Syntax.Literal) {
8012 // this is not directive
8013 break;
8014 }
8015 directive = source.slice(token.range[0] + 1, token.range[1] - 1);
8016 if (directive === 'use strict') {
8017 strict = true;
8018 if (firstRestricted) {
8019 throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
8020 }
8021 } else {
8022 if (!firstRestricted && token.octal) {
8023 firstRestricted = token;
8024 }
8025 }
8026 }
8027
8028 oldLabelSet = state.labelSet;
8029 oldInIteration = state.inIteration;
8030 oldInSwitch = state.inSwitch;
8031 oldInFunctionBody = state.inFunctionBody;
8032 oldParenthesizedCount = state.parenthesizedCount;
8033
8034 state.labelSet = new StringMap();
8035 state.inIteration = false;
8036 state.inSwitch = false;
8037 state.inFunctionBody = true;
8038 state.parenthesizedCount = 0;
8039
8040 while (index < length) {
8041 if (match('}')) {
8042 break;
8043 }
8044 sourceElement = parseSourceElement();
8045 if (typeof sourceElement === 'undefined') {
8046 break;
8047 }
8048 sourceElements.push(sourceElement);
8049 }
8050
8051 expect('}');
8052
8053 state.labelSet = oldLabelSet;

Callers 3

parseConciseBodyFunction · 0.85
parseFunctionDeclarationFunction · 0.85
parseFunctionExpressionFunction · 0.85

Calls 6

markerCreateFunction · 0.85
expectFunction · 0.85
parseSourceElementFunction · 0.85
throwErrorTolerantFunction · 0.85
matchFunction · 0.85
markerApplyFunction · 0.85

Tested by

no test coverage detected