MCPcopy
hub / github.com/jquery/esprima / parseFunctionSourceElements

Method parseFunctionSourceElements

src/parser.ts:2719–2750  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2717 // https://tc39.github.io/ecma262/#sec-function-definitions
2718
2719 parseFunctionSourceElements(): Node.BlockStatement {
2720 const node = this.createNode();
2721
2722 this.expect('{');
2723 const body = this.parseDirectivePrologues();
2724
2725 const previousLabelSet = this.context.labelSet;
2726 const previousInIteration = this.context.inIteration;
2727 const previousInSwitch = this.context.inSwitch;
2728 const previousInFunctionBody = this.context.inFunctionBody;
2729
2730 this.context.labelSet = {};
2731 this.context.inIteration = false;
2732 this.context.inSwitch = false;
2733 this.context.inFunctionBody = true;
2734
2735 while (this.lookahead.type !== Token.EOF) {
2736 if (this.match('}')) {
2737 break;
2738 }
2739 body.push(this.parseStatementListItem());
2740 }
2741
2742 this.expect('}');
2743
2744 this.context.labelSet = previousLabelSet;
2745 this.context.inIteration = previousInIteration;
2746 this.context.inSwitch = previousInSwitch;
2747 this.context.inFunctionBody = previousInFunctionBody;
2748
2749 return this.finalize(node, new Node.BlockStatement(body));
2750 }
2751
2752 validateParam(options, param, name) {
2753 const key = '$' + name;

Callers 3

Calls 7

createNodeMethod · 0.95
expectMethod · 0.95
matchMethod · 0.95
finalizeMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected