aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-19 21:47:01 +0000
committerGitHub <noreply@github.com>2020-12-20 05:47:01 +0800
commit87cf7152135281a4b1a1163b26ea918a0a264f0b (patch)
tree41dd955905f0eebf5cd9f2f215bb26653cbb2a4e /lib/scope.js
parent2c9c72e06c674ae313001d0b5878fe2ccfc31492 (diff)
downloadtracifyjs-87cf7152135281a4b1a1163b26ea918a0a264f0b.tar.gz
tracifyjs-87cf7152135281a4b1a1163b26ea918a0a264f0b.zip
fix corner case with destructuring `catch` (#4421)
fixes #4420
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/scope.js b/lib/scope.js
index fac673bc..779637cb 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -208,6 +208,14 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
self.globals = new Dictionary();
var in_arg = [];
var tw = new TreeWalker(function(node) {
+ if (node instanceof AST_Catch) {
+ if (!(node.argname instanceof AST_Destructured)) return;
+ in_arg.push(node);
+ node.argname.walk(tw);
+ in_arg.pop();
+ walk_body(node, tw);
+ return true;
+ }
if (node instanceof AST_Lambda) {
in_arg.push(node);
node.argnames.forEach(function(argname) {