fix(es/parser): Fix ASI hazard of static (#8262)

**Related issue:**

 - Closes #8253
This commit is contained in:
magic-akari 2023-11-13 18:02:02 +08:00 committed by GitHub
parent 35b95ae430
commit c1281534b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,14 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript"
},
"target": "es2022",
"loose": false
},
"module": {
"type": "es6"
},
"minify": false,
"isModule": true
}

View File

@ -0,0 +1,4 @@
class Foo {
static
bar = 1
}

View File

@ -0,0 +1,3 @@
class Foo {
static bar = 1;
}

View File

@ -534,7 +534,7 @@ impl<I: Tokens> Parser<I> {
kind: MethodKind::Method, kind: MethodKind::Method,
}, },
); );
} else if self.is_class_property(/* asi */ true) } else if self.is_class_property(/* asi */ false)
|| (self.syntax().typescript() && is!(self, '?')) || (self.syntax().typescript() && is!(self, '?'))
{ {
// Property named `static` // Property named `static`