From 1637a3e67d5a102cf33e98fe5437a50c644e5cf9 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 13 Oct 2023 18:04:07 -0700 Subject: [PATCH] Fix scope lookup with optional catch binding Fixes #944. Signed-off-by: Anders Kaseorg --- src/scope.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scope.ts b/src/scope.ts index 24f554ea..0d92a3eb 100644 --- a/src/scope.ts +++ b/src/scope.ts @@ -197,7 +197,7 @@ export default function scopePlugin(fork: Fork) { } } if (ScopeType.check(node)) { - if (namedTypes.CatchClause.check(node)) { + if (namedTypes.CatchClause.check(node) && node.param !== null) { // A catch clause establishes a new scope but the only variable // bound in that scope is the catch parameter. Any other // declarations create bindings in the outer scope.