* Walk for statement. * @param {ForStatement} statement for statement
(statement)
| 2668 | * @param {ForStatement} statement for statement |
| 2669 | */ |
| 2670 | walkForStatement(statement) { |
| 2671 | this.inBlockScope(() => { |
| 2672 | if (statement.init) { |
| 2673 | if (statement.init.type === "VariableDeclaration") { |
| 2674 | this.blockPreWalkVariableDeclaration(statement.init); |
| 2675 | this.prevStatement = undefined; |
| 2676 | this.walkStatement(statement.init); |
| 2677 | } else { |
| 2678 | this.walkExpression(statement.init); |
| 2679 | } |
| 2680 | } |
| 2681 | if (statement.test) { |
| 2682 | this.walkExpression(statement.test); |
| 2683 | } |
| 2684 | if (statement.update) { |
| 2685 | this.walkExpression(statement.update); |
| 2686 | } |
| 2687 | |
| 2688 | const body = statement.body; |
| 2689 | |
| 2690 | if (body.type === "BlockStatement") { |
| 2691 | // no need to add additional scope |
| 2692 | const prev = this.prevStatement; |
| 2693 | this.blockPreWalkStatements(body.body); |
| 2694 | this.prevStatement = prev; |
| 2695 | this.walkStatements(body.body); |
| 2696 | } else { |
| 2697 | this.walkNestedStatement(body); |
| 2698 | } |
| 2699 | }); |
| 2700 | } |
| 2701 | |
| 2702 | /** |
| 2703 | * Pre walk for in statement. |
no test coverage detected