fix corner case with destructuring catch (#4421)

fixes #4420
This commit is contained in:
Alex Lam S.L
2020-12-19 21:47:01 +00:00
committed by GitHub
parent 2c9c72e06c
commit 87cf715213
3 changed files with 55 additions and 0 deletions

View File

@@ -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) {