aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-27 01:26:15 +0000
committerGitHub <noreply@github.com>2021-02-27 09:26:15 +0800
commit0a42457df64944187a069b26491fcebd8ce55ce0 (patch)
tree346d0655d7aaf2a828c6aeb66aabedc92b57cf19 /lib
parentba4a771bbccb0b6026588a56b0c31f5bac466775 (diff)
downloadtracifyjs-0a42457df64944187a069b26491fcebd8ce55ce0.tar.gz
tracifyjs-0a42457df64944187a069b26491fcebd8ce55ce0.zip
fix corner case with `arguments` (#4697)
fixes #4696
Diffstat (limited to 'lib')
-rw-r--r--lib/ast.js2
-rw-r--r--lib/scope.js1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 5fe6efc1..1aee1044 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -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;
}