Browse Source

Fix parsing of binding identifier in try catch parameters (#3752)

pull/3758/head
raskad 9 months ago committed by GitHub
parent
commit
abec7b2ec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      core/parser/src/parser/statement/try_stm/catch.rs

13
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)?,
)),
}
}

Loading…
Cancel
Save