diff options
-rw-r--r-- | lib/ast.js | 2 | ||||
-rw-r--r-- | lib/scope.js | 1 | ||||
-rw-r--r-- | test/compress/arguments.js | 22 |
3 files changed, 24 insertions, 1 deletions
@@ -428,7 +428,7 @@ var AST_For = DEFNODE("For", "init condition step", { }, AST_IterationStatement); var AST_ForEnumeration = DEFNODE("ForEnumeration", "init object", { - $documentation: "Base class for enumeration loops, i.e. `for ... in`, `for ... of` & `for await ... of`", + $documentation: "Base class for enumeration loops, i.e. `for ... in`, `for ... of` & `for await ... of`", $propdoc: { init: "[AST_Node] the assignment target during iteration", object: "[AST_Node] the object to iterate over" diff --git a/lib/scope.js b/lib/scope.js index 600a6869..b22f77a2 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -108,6 +108,7 @@ function is_lhs(node, parent) { if (parent instanceof AST_DefaultValue) return parent.name === node && node; if (parent instanceof AST_Destructured) return node; if (parent instanceof AST_DestructuredKeyVal) return node; + if (parent instanceof AST_ForEnumeration) return parent.init === node && node; if (parent instanceof AST_Unary) return unary_side_effects[parent.operator] && parent.expression; } diff --git a/test/compress/arguments.js b/test/compress/arguments.js index 655d75a4..4c602a68 100644 --- a/test/compress/arguments.js +++ b/test/compress/arguments.js @@ -977,3 +977,25 @@ issue_4432: { } expect_stdout: "PASS" } + +issue_4696: { + options = { + arguments: true, + keep_fargs: false, + } + input: { + console.log(function() { + for (arguments in [ 42 ]); + for (var a in arguments[0]) + return "PASS"; + }()); + } + expect: { + console.log(function() { + for (arguments in [ 42 ]); + for (var a in arguments[0]) + return "PASS"; + }()); + } + expect_stdout: "PASS" +} |