@@ -1030,23 +1030,28 @@ class Parser extends Tapable { |
1030 | 1030 | } |
1031 | 1031 |
|
1032 | 1032 | walkForInStatement(statement) { |
1033 | | - if (statement.left.type === "VariableDeclaration") |
| 1033 | + if (statement.left.type === "VariableDeclaration") { |
1034 | 1034 | this.walkVariableDeclaration(statement.left); |
1035 | | - else this.walkPattern(statement.left); |
| 1035 | + } else { |
| 1036 | + this.walkPattern(statement.left); |
| 1037 | + } |
1036 | 1038 | this.walkExpression(statement.right); |
1037 | 1039 | this.walkStatement(statement.body); |
1038 | 1040 | } |
1039 | 1041 |
|
1040 | 1042 | prewalkForOfStatement(statement) { |
1041 | | - if (statement.left.type === "VariableDeclaration") |
| 1043 | + if (statement.left.type === "VariableDeclaration") { |
1042 | 1044 | this.prewalkVariableDeclaration(statement.left); |
| 1045 | + } |
1043 | 1046 | this.prewalkStatement(statement.body); |
1044 | 1047 | } |
1045 | 1048 |
|
1046 | 1049 | walkForOfStatement(statement) { |
1047 | | - if (statement.left.type === "VariableDeclaration") |
| 1050 | + if (statement.left.type === "VariableDeclaration") { |
1048 | 1051 | this.walkVariableDeclaration(statement.left); |
1049 | | - else this.walkPattern(statement.left); |
| 1052 | + } else { |
| 1053 | + this.walkPattern(statement.left); |
| 1054 | + } |
1050 | 1055 | this.walkExpression(statement.right); |
1051 | 1056 | this.walkStatement(statement.body); |
1052 | 1057 | } |
@@ -1062,8 +1067,10 @@ class Parser extends Tapable { |
1062 | 1067 | walkFunctionDeclaration(statement) { |
1063 | 1068 | const wasTopLevel = this.scope.topLevelScope; |
1064 | 1069 | this.scope.topLevelScope = false; |
1065 | | - for (const param of statement.params) this.walkPattern(param); |
1066 | 1070 | this.inScope(statement.params, () => { |
| 1071 | + for (const param of statement.params) { |
| 1072 | + this.walkPattern(param); |
| 1073 | + } |
1067 | 1074 | if (statement.body.type === "BlockStatement") { |
1068 | 1075 | this.detectStrictMode(statement.body.body); |
1069 | 1076 | this.prewalkStatement(statement.body); |
@@ -1355,13 +1362,10 @@ class Parser extends Tapable { |
1355 | 1362 | } |
1356 | 1363 |
|
1357 | 1364 | walkExpressions(expressions) { |
1358 | | - for ( |
1359 | | - let expressionsIndex = 0, len = expressions.length; |
1360 | | - expressionsIndex < len; |
1361 | | - expressionsIndex++ |
1362 | | - ) { |
1363 | | - const expression = expressions[expressionsIndex]; |
1364 | | - if (expression) this.walkExpression(expression); |
| 1365 | + for (const expression of expressions) { |
| 1366 | + if (expression) { |
| 1367 | + this.walkExpression(expression); |
| 1368 | + } |
1365 | 1369 | } |
1366 | 1370 | } |
1367 | 1371 |
|
@@ -1469,8 +1473,10 @@ class Parser extends Tapable { |
1469 | 1473 | walkFunctionExpression(expression) { |
1470 | 1474 | const wasTopLevel = this.scope.topLevelScope; |
1471 | 1475 | this.scope.topLevelScope = false; |
1472 | | - for (const param of expression.params) this.walkPattern(param); |
1473 | 1476 | this.inScope(expression.params, () => { |
| 1477 | + for (const param of expression.params) { |
| 1478 | + this.walkPattern(param); |
| 1479 | + } |
1474 | 1480 | if (expression.body.type === "BlockStatement") { |
1475 | 1481 | this.detectStrictMode(expression.body.body); |
1476 | 1482 | this.prewalkStatement(expression.body); |
@@ -1483,8 +1489,10 @@ class Parser extends Tapable { |
1483 | 1489 | } |
1484 | 1490 |
|
1485 | 1491 | walkArrowFunctionExpression(expression) { |
1486 | | - for (const param of expression.params) this.walkPattern(param); |
1487 | 1492 | this.inScope(expression.params, () => { |
| 1493 | + for (const param of expression.params) { |
| 1494 | + this.walkPattern(param); |
| 1495 | + } |
1488 | 1496 | if (expression.body.type === "BlockStatement") { |
1489 | 1497 | this.detectStrictMode(expression.body.body); |
1490 | 1498 | this.prewalkStatement(expression.body); |
@@ -1640,7 +1648,9 @@ class Parser extends Tapable { |
1640 | 1648 | if (functionExpression.body.type === "BlockStatement") { |
1641 | 1649 | this.prewalkStatement(functionExpression.body); |
1642 | 1650 | this.walkStatement(functionExpression.body); |
1643 | | - } else this.walkExpression(functionExpression.body); |
| 1651 | + } else { |
| 1652 | + this.walkExpression(functionExpression.body); |
| 1653 | + } |
1644 | 1654 | }); |
1645 | 1655 | this.scope.topLevelScope = wasTopLevel; |
1646 | 1656 | } |
@@ -1743,13 +1753,7 @@ class Parser extends Tapable { |
1743 | 1753 |
|
1744 | 1754 | this.scope.renames.set("this", null); |
1745 | 1755 |
|
1746 | | - for ( |
1747 | | - let paramIndex = 0, len = params.length; |
1748 | | - paramIndex < len; |
1749 | | - paramIndex++ |
1750 | | - ) { |
1751 | | - const param = params[paramIndex]; |
1752 | | - |
| 1756 | + for (const param of params) { |
1753 | 1757 | if (typeof param !== "string") { |
1754 | 1758 | this.enterPattern(param, param => { |
1755 | 1759 | this.scope.renames.set(param, null); |
|