MCPcopy
hub / github.com/webpack/webpack / walkForInStatement

Method walkForInStatement

lib/javascript/JavascriptParser.js:2717–2740  ·  view source on GitHub ↗

* Walk for in statement. * @param {ForInStatement} statement for statement

(statement)

Source from the content-addressed store, hash-verified

2715 * @param {ForInStatement} statement for statement
2716 */
2717 walkForInStatement(statement) {
2718 this.inBlockScope(() => {
2719 if (statement.left.type === "VariableDeclaration") {
2720 this.blockPreWalkVariableDeclaration(statement.left);
2721 this.walkVariableDeclaration(statement.left);
2722 } else {
2723 this.walkPattern(statement.left);
2724 }
2725
2726 this.walkExpression(statement.right);
2727
2728 const body = statement.body;
2729
2730 if (body.type === "BlockStatement") {
2731 // no need to add additional scope
2732 const prev = this.prevStatement;
2733 this.blockPreWalkStatements(body.body);
2734 this.prevStatement = prev;
2735 this.walkStatements(body.body);
2736 } else {
2737 this.walkNestedStatement(body);
2738 }
2739 });
2740 }
2741
2742 /**
2743 * Pre walk for of statement.

Callers 1

walkStatementMethod · 0.95

Calls 8

inBlockScopeMethod · 0.95
walkPatternMethod · 0.95
walkExpressionMethod · 0.95
walkStatementsMethod · 0.95
walkNestedStatementMethod · 0.95

Tested by

no test coverage detected