fix(parser): ASI of async class member (#1214)

Co-authored-by: Boshen <boshenc@gmail.com>
This commit is contained in:
magic-akari 2023-11-11 00:21:51 +08:00 committed by GitHub
parent a60b7e5856
commit 8afb81aa34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -200,7 +200,9 @@ impl<'a> Parser<'a> {
// async ...
if key_name.is_none() && self.at(Kind::Async) && !self.peek_at(Kind::Question) {
if self.peek_kind().is_class_element_name_start() || self.peek_at(Kind::Star) {
if !self.peek_token().is_on_new_line
&& (self.peek_kind().is_class_element_name_start() || self.peek_at(Kind::Star))
{
self.bump(Kind::Async);
r#async = true;
} else {

View file

@ -1,6 +1,9 @@
class C {
async
async
foo() {}
static
static
static
bar() {}
}