Browse Source

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

pull/3758/head
raskad 8 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)?; .parse(cursor, interner)?;
Ok(Binding::Pattern(pat.into())) Ok(Binding::Pattern(pat.into()))
} }
TokenKind::IdentifierName(_) => { _ => Ok(Binding::Identifier(
let ident = BindingIdentifier::new(self.allow_yield, self.allow_await) BindingIdentifier::new(self.allow_yield, self.allow_await)
.parse(cursor, interner)?; .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",
)), )),
} }
} }

Loading…
Cancel
Save