From abec7b2ec21cce9373cf208beaedc75821adfb67 Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Wed, 20 Mar 2024 23:03:58 +0100 Subject: [PATCH] Fix parsing of binding identifier in try catch parameters (#3752) --- core/parser/src/parser/statement/try_stm/catch.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/core/parser/src/parser/statement/try_stm/catch.rs b/core/parser/src/parser/statement/try_stm/catch.rs index e43b0c627e..b7815f7fc1 100644 --- a/core/parser/src/parser/statement/try_stm/catch.rs +++ b/core/parser/src/parser/statement/try_stm/catch.rs @@ -168,16 +168,9 @@ where .parse(cursor, interner)?; Ok(Binding::Pattern(pat.into())) } - TokenKind::IdentifierName(_) => { - let ident = BindingIdentifier::new(self.allow_yield, self.allow_await) - .parse(cursor, interner)?; - Ok(Binding::Identifier(ident)) - } - _ => Err(Error::expected( - [String::from("pattern"), String::from("binding identifier")], - token.to_string(interner), - token.span(), - "catch parameter", + _ => Ok(Binding::Identifier( + BindingIdentifier::new(self.allow_yield, self.allow_await) + .parse(cursor, interner)?, )), } }