MCPcopy Index your code
hub / github.com/BloombergGraphics/whatiscode / parseFunctionExpression

Function parseFunctionExpression

scripts/libs/esprima.js:4108–4152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4106 }
4107
4108 function parseFunctionExpression() {
4109 var token, id = null, stricted, firstRestricted, message, tmp,
4110 params = [], defaults = [], body, previousStrict, node = new Node();
4111
4112 expectKeyword('function');
4113
4114 if (!match('(')) {
4115 token = lookahead;
4116 id = parseVariableIdentifier();
4117 if (strict) {
4118 if (isRestrictedWord(token.value)) {
4119 tolerateUnexpectedToken(token, Messages.StrictFunctionName);
4120 }
4121 } else {
4122 if (isRestrictedWord(token.value)) {
4123 firstRestricted = token;
4124 message = Messages.StrictFunctionName;
4125 } else if (isStrictModeReservedWord(token.value)) {
4126 firstRestricted = token;
4127 message = Messages.StrictReservedWord;
4128 }
4129 }
4130 }
4131
4132 tmp = parseParams(firstRestricted);
4133 params = tmp.params;
4134 defaults = tmp.defaults;
4135 stricted = tmp.stricted;
4136 firstRestricted = tmp.firstRestricted;
4137 if (tmp.message) {
4138 message = tmp.message;
4139 }
4140
4141 previousStrict = strict;
4142 body = parseFunctionSourceElements();
4143 if (strict && firstRestricted) {
4144 throwUnexpectedToken(firstRestricted, message);
4145 }
4146 if (strict && stricted) {
4147 tolerateUnexpectedToken(stricted, message);
4148 }
4149 strict = previousStrict;
4150
4151 return node.finishFunctionExpression(id, params, defaults, body);
4152 }
4153
4154
4155 function parseClassBody() {

Callers 1

parsePrimaryExpressionFunction · 0.85

Calls 9

expectKeywordFunction · 0.85
matchFunction · 0.85
parseVariableIdentifierFunction · 0.85
isRestrictedWordFunction · 0.85
tolerateUnexpectedTokenFunction · 0.85
isStrictModeReservedWordFunction · 0.85
parseParamsFunction · 0.85
throwUnexpectedTokenFunction · 0.85

Tested by

no test coverage detected