feat(codegen): minify yield "s" -> yield"s" (#8084)

This commit is contained in:
Boshen 2024-12-24 00:41:28 +00:00
parent f8f067bfc6
commit 414c118309
2 changed files with 4 additions and 7 deletions

View file

@ -1807,9 +1807,7 @@ impl GenExpr for YieldExpression<'_> {
p.print_soft_space();
}
if let Some(argument) = self.argument.as_ref() {
if !self.delegate {
p.print_hard_space();
}
p.print_soft_space();
argument.print_expr(p, Precedence::Yield, Context::empty());
}
});

View file

@ -170,7 +170,6 @@ fn r#yield() {
"function *foo() { yield { a } = [ b ] = c ? b : d }",
"function*foo(){yield{a}=[b]=c?b:d}",
);
// TODO: remove the extra space in `yield (a,b)`
test_minify("function *foo() { yield (a, b) }", "function*foo(){yield(a,b)}");
test_minify("function *foo() { yield a, b }", "function*foo(){yield a,b}");
}