From 2b613071fa2d07be5ac653884c1496f3113fcaed Mon Sep 17 00:00:00 2001 From: IWANABETHATGUY Date: Thu, 11 Jul 2024 18:41:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20avoid=20print=20extra?= =?UTF-8?q?=20semicolon=20after=20access=20property?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxc_codegen/src/gen.rs | 1 - crates/oxc_codegen/tests/mod.rs | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 96f239ef238b5..00c5590511433 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -2491,7 +2491,6 @@ impl<'a, const MINIFY: bool> Gen for AccessorProperty<'a> { p.print_equal(); value.gen_expr(p, Precedence::Assign, Context::default()); } - p.print_semicolon(); } } diff --git a/crates/oxc_codegen/tests/mod.rs b/crates/oxc_codegen/tests/mod.rs index 314a70a12511e..b92a852333297 100644 --- a/crates/oxc_codegen/tests/mod.rs +++ b/crates/oxc_codegen/tests/mod.rs @@ -124,6 +124,14 @@ fn new_expr() { test("new (foo()).bar();", "new (foo()).bar();\n"); } +#[test] +fn access_property() { + test( + "export default class Foo { @x @y accessor #aDef = 1 }", + "export default class Foo {\n\taccessor #aDef=1;\n}\n", + ); +} + #[test] fn for_stmt() { test("for (let x = 0; x < 10; x++) {}", "for (let x = 0; x < 10; x++) {}\n"); From 4863b00b4f90274f6eaea0f20c00f5d9245e0456 Mon Sep 17 00:00:00 2001 From: IWANABETHATGUY Date: Thu, 11 Jul 2024 18:53:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=F0=9F=A4=96=20update=20snapshot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks/coverage/codegen_sourcemap.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/coverage/codegen_sourcemap.snap b/tasks/coverage/codegen_sourcemap.snap index 663133b3f054c..6a6ad154e3694 100644 --- a/tasks/coverage/codegen_sourcemap.snap +++ b/tasks/coverage/codegen_sourcemap.snap @@ -275,7 +275,7 @@ Unexpected token (29:11-29:15) " y =" --> (25:10-25:12) " y" (29:15-29:26) " function()" --> (25:12-25:23) "=function()" (29:26-29:28) " {" --> (25:23-25:24) " " -(29:28-30:1) "}\n" --> (25:24-26:0) "{};;" +(29:28-30:1) "}\n" --> (25:24-26:0) "{};" (30:1-32:0) "}\n" --> (26:0-27:0) "\n}" (32:0-32:4) "\nvar" --> (27:0-27:4) "\nvar" (32:4-32:9) " aa =" --> (27:4-27:9) " aa ="