MCPcopy Index your code
hub / github.com/dchester/jsonpath / parseFunctionExpression

Function parseFunctionExpression

jsonpath.js:3447–3490  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3445 }
3446
3447 function parseFunctionExpression() {
3448 var token, id = null, stricted, firstRestricted, message, tmp, params = [], body, previousStrict, startToken;
3449
3450 startToken = lookahead;
3451 expectKeyword('function');
3452
3453 if (!match('(')) {
3454 token = lookahead;
3455 id = parseVariableIdentifier();
3456 if (strict) {
3457 if (isRestrictedWord(token.value)) {
3458 throwErrorTolerant(token, Messages.StrictFunctionName);
3459 }
3460 } else {
3461 if (isRestrictedWord(token.value)) {
3462 firstRestricted = token;
3463 message = Messages.StrictFunctionName;
3464 } else if (isStrictModeReservedWord(token.value)) {
3465 firstRestricted = token;
3466 message = Messages.StrictReservedWord;
3467 }
3468 }
3469 }
3470
3471 tmp = parseParams(firstRestricted);
3472 params = tmp.params;
3473 stricted = tmp.stricted;
3474 firstRestricted = tmp.firstRestricted;
3475 if (tmp.message) {
3476 message = tmp.message;
3477 }
3478
3479 previousStrict = strict;
3480 body = parseFunctionSourceElements();
3481 if (strict && firstRestricted) {
3482 throwError(firstRestricted, message);
3483 }
3484 if (strict && stricted) {
3485 throwErrorTolerant(stricted, message);
3486 }
3487 strict = previousStrict;
3488
3489 return delegate.markEnd(delegate.createFunctionExpression(id, params, [], body), startToken);
3490 }
3491
3492 // 14 Program
3493

Callers 1

parsePrimaryExpressionFunction · 0.85

Calls 9

expectKeywordFunction · 0.85
matchFunction · 0.85
parseVariableIdentifierFunction · 0.85
isRestrictedWordFunction · 0.85
throwErrorTolerantFunction · 0.85
isStrictModeReservedWordFunction · 0.85
parseParamsFunction · 0.85
throwErrorFunction · 0.85

Tested by

no test coverage detected