From 728ed20c1ceab8fd1858689c85b9ba5648e5d2bc Mon Sep 17 00:00:00 2001 From: Boshen Date: Tue, 24 Dec 2024 21:57:58 +0800 Subject: [PATCH] fix(codegen): print `yield * ident` correctly --- crates/oxc_codegen/src/gen.rs | 1 - crates/oxc_codegen/tests/integration/unit.rs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 6e08e72f28f84..5b20c8f385474 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -1822,7 +1822,6 @@ impl GenExpr for YieldExpression<'_> { p.print_str("yield"); if self.delegate { p.print_ascii_byte(b'*'); - p.print_soft_space(); } if let Some(argument) = self.argument.as_ref() { p.print_soft_space(); diff --git a/crates/oxc_codegen/tests/integration/unit.rs b/crates/oxc_codegen/tests/integration/unit.rs index ac467ede2e8b8..fa0434aed7fdc 100644 --- a/crates/oxc_codegen/tests/integration/unit.rs +++ b/crates/oxc_codegen/tests/integration/unit.rs @@ -169,6 +169,7 @@ fn assignment() { #[test] fn r#yield() { + test("function * foo() { yield * 1 }", "function* foo() {\n\tyield* 1;\n}\n"); test_minify("function *foo() { yield }", "function*foo(){yield}"); 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}");