mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(codegen): minify yield "s" -> yield"s" (#8084)
This commit is contained in:
parent
f8f067bfc6
commit
414c118309
2 changed files with 4 additions and 7 deletions
|
|
@ -1807,9 +1807,7 @@ impl GenExpr for YieldExpression<'_> {
|
||||||
p.print_soft_space();
|
p.print_soft_space();
|
||||||
}
|
}
|
||||||
if let Some(argument) = self.argument.as_ref() {
|
if let Some(argument) = self.argument.as_ref() {
|
||||||
if !self.delegate {
|
p.print_soft_space();
|
||||||
p.print_hard_space();
|
|
||||||
}
|
|
||||||
argument.print_expr(p, Precedence::Yield, Context::empty());
|
argument.print_expr(p, Precedence::Yield, Context::empty());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -164,14 +164,13 @@ fn r#yield() {
|
||||||
test_minify("function *foo() { yield * async () => {} }", "function*foo(){yield*async()=>{}}");
|
test_minify("function *foo() { yield * async () => {} }", "function*foo(){yield*async()=>{}}");
|
||||||
test_minify("function *foo() { yield a ? b : c }", "function*foo(){yield a?b:c}");
|
test_minify("function *foo() { yield a ? b : c }", "function*foo(){yield a?b:c}");
|
||||||
test_minify("function *foo() { yield yield a }", "function*foo(){yield yield a}");
|
test_minify("function *foo() { yield yield a }", "function*foo(){yield yield a}");
|
||||||
test_minify("function *foo() { yield () => {} }", "function*foo(){yield ()=>{}}");
|
test_minify("function *foo() { yield () => {} }", "function*foo(){yield()=>{}}");
|
||||||
test_minify("function *foo() { yield async () => {} }", "function*foo(){yield async()=>{}}");
|
test_minify("function *foo() { yield async () => {} }", "function*foo(){yield async()=>{}}");
|
||||||
test_minify(
|
test_minify(
|
||||||
"function *foo() { yield { a } = [ b ] = c ? b : d }",
|
"function *foo() { yield { a } = [ b ] = c ? b : d }",
|
||||||
"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)}");
|
|
||||||
test_minify("function *foo() { yield a, b }", "function*foo(){yield a,b}");
|
test_minify("function *foo() { yield a, b }", "function*foo(){yield a,b}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue