From a56cb1b4827d0ea27baa9eac27eff14fae62c040 Mon Sep 17 00:00:00 2001 From: Dunqing <29533304+Dunqing@users.noreply.github.com> Date: Sat, 15 Jun 2024 13:34:29 +0000 Subject: [PATCH] feat(codegen): print accessibility for MethodDefinition (#3690) --- crates/oxc_codegen/src/gen.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 427e47f230d81..8b2d251ee62d8 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -2302,7 +2302,9 @@ impl<'a, const MINIFY: bool> Gen for MethodDefinition<'a> { if self.r#type == MethodDefinitionType::TSAbstractMethodDefinition { p.print_str(b"abstract "); } - + if let Some(accessibility) = &self.accessibility { + accessibility.gen(p, ctx); + } if self.r#static { p.print_str(b"static "); } @@ -2356,18 +2358,9 @@ impl<'a, const MINIFY: bool> Gen for PropertyDefinition<'a> { p.print_str(b"abstract "); } if let Some(accessibility) = &self.accessibility { - match accessibility { - TSAccessibility::Private => { - p.print_str(b"private "); - } - TSAccessibility::Protected => { - p.print_str(b"protected "); - } - TSAccessibility::Public => { - p.print_str(b"public "); - } - } + accessibility.gen(p, ctx); } + if self.r#static { p.print_str(b"static "); }