fix(es/minifier): Don't generate generator arrows (#7466)

**Related issue:**

 - Closes #7457.
This commit is contained in:
Donny/강동윤 2023-05-31 10:57:13 +09:00 committed by GitHub
parent ad8e6a006c
commit e506635f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View File

@ -21,7 +21,7 @@ impl Pure<'_> {
function,
}) = e
{
if contains_this_expr(&function.body) {
if contains_this_expr(&function.body) || function.is_generator {
return;
}

View File

@ -0,0 +1,4 @@
{
"ecma": "2022",
"unsafe_arrows": true
}

View File

@ -0,0 +1,6 @@
function bar() {
return function* () {
yield foo();
};
}
console.log(bar());

View File

@ -0,0 +1,6 @@
function bar() {
return function*() {
yield foo();
};
}
console.log(bar());