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

Function parseFunctionDeclaration

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

Source from the content-addressed store, hash-verified

8186 }
8187
8188 function parseFunctionDeclaration() {
8189 var id, body, token, tmp, firstRestricted, message, generator, isAsync,
8190 previousStrict, previousYieldAllowed, previousAwaitAllowed,
8191 marker = markerCreate(), typeParameters;
8192
8193 isAsync = false;
8194 if (matchAsync()) {
8195 lex();
8196 isAsync = true;
8197 }
8198
8199 expectKeyword('function');
8200
8201 generator = false;
8202 if (match('*')) {
8203 lex();
8204 generator = true;
8205 }
8206
8207 token = lookahead;
8208
8209 id = parseVariableIdentifier();
8210
8211 if (match('<')) {
8212 typeParameters = parseTypeParameterDeclaration();
8213 }
8214
8215 if (strict) {
8216 if (isRestrictedWord(token.value)) {
8217 throwErrorTolerant(token, Messages.StrictFunctionName);
8218 }
8219 } else {
8220 if (isRestrictedWord(token.value)) {
8221 firstRestricted = token;
8222 message = Messages.StrictFunctionName;
8223 } else if (isStrictModeReservedWord(token.value)) {
8224 firstRestricted = token;
8225 message = Messages.StrictReservedWord;
8226 }
8227 }
8228
8229 tmp = parseParams(firstRestricted);
8230 firstRestricted = tmp.firstRestricted;
8231 if (tmp.message) {
8232 message = tmp.message;
8233 }
8234
8235 previousStrict = strict;
8236 previousYieldAllowed = state.yieldAllowed;
8237 state.yieldAllowed = generator;
8238 previousAwaitAllowed = state.awaitAllowed;
8239 state.awaitAllowed = isAsync;
8240
8241 body = parseFunctionSourceElements();
8242
8243 if (strict && firstRestricted) {
8244 throwError(firstRestricted, message);
8245 }

Callers 2

parseStatementFunction · 0.85
parseSourceElementFunction · 0.85

Calls 14

markerCreateFunction · 0.85
matchAsyncFunction · 0.85
lexFunction · 0.85
expectKeywordFunction · 0.85
matchFunction · 0.85
parseVariableIdentifierFunction · 0.85
isRestrictedWordFunction · 0.85
throwErrorTolerantFunction · 0.85
isStrictModeReservedWordFunction · 0.85
parseParamsFunction · 0.85

Tested by

no test coverage detected