MCPcopy
hub / github.com/webpack/webpack / walkForOfStatement

Method walkForOfStatement

lib/javascript/JavascriptParser.js:2760–2783  ·  view source on GitHub ↗

* Walk for of statement. * @param {ForOfStatement} statement for statement

(statement)

Source from the content-addressed store, hash-verified

2758 * @param {ForOfStatement} statement for statement
2759 */
2760 walkForOfStatement(statement) {
2761 this.inBlockScope(() => {
2762 if (statement.left.type === "VariableDeclaration") {
2763 this.blockPreWalkVariableDeclaration(statement.left);
2764 this.walkVariableDeclaration(statement.left);
2765 } else {
2766 this.walkPattern(statement.left);
2767 }
2768
2769 this.walkExpression(statement.right);
2770
2771 const body = statement.body;
2772
2773 if (body.type === "BlockStatement") {
2774 // no need to add additional scope
2775 const prev = this.prevStatement;
2776 this.blockPreWalkStatements(body.body);
2777 this.prevStatement = prev;
2778 this.walkStatements(body.body);
2779 } else {
2780 this.walkNestedStatement(body);
2781 }
2782 });
2783 }
2784
2785 /**
2786 * Pre walk function declaration.

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