MCPcopy
hub / github.com/webpack/webpack / walkFunctionExpression

Method walkFunctionExpression

lib/javascript/JavascriptParser.js:3694–3717  ·  view source on GitHub ↗

* Walk function expression. * @param {FunctionExpression} expression arrow function expression

(expression)

Source from the content-addressed store, hash-verified

3692 * @param {FunctionExpression} expression arrow function expression
3693 */
3694 walkFunctionExpression(expression) {
3695 const wasTopLevel = this.scope.topLevelScope;
3696 this.scope.topLevelScope = false;
3697 // Only copy params when the function name must be added (recursive calls);
3698 // inFunctionScope reads params without mutating, like arrow functions.
3699 const scopeParams = expression.id
3700 ? [...expression.params, expression.id]
3701 : expression.params;
3702
3703 this.inFunctionScope(true, scopeParams, () => {
3704 for (const param of expression.params) {
3705 this.walkPattern(param);
3706 }
3707
3708 this.detectMode(expression.body.body);
3709
3710 const prev = this.prevStatement;
3711
3712 this.preWalkStatement(expression.body);
3713 this.prevStatement = prev;
3714 this.walkStatement(expression.body);
3715 });
3716 this.scope.topLevelScope = wasTopLevel;
3717 }
3718
3719 /**
3720 * Walk arrow function expression.

Callers 1

walkExpressionMethod · 0.95

Calls 5

inFunctionScopeMethod · 0.95
walkPatternMethod · 0.95
detectModeMethod · 0.95
preWalkStatementMethod · 0.95
walkStatementMethod · 0.95

Tested by

no test coverage detected