mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
feat(codegen): keep shorthand in ObjectPattern and ObjectProperty (#2265)
close: #2262 Do I need to add a test for this?
This commit is contained in:
parent
d6ba058f77
commit
8ac0202c9a
1 changed files with 12 additions and 4 deletions
|
|
@ -1371,11 +1371,15 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for ObjectProperty<'a> {
|
|||
if self.computed {
|
||||
p.print(b'[');
|
||||
}
|
||||
self.key.gen(p, ctx);
|
||||
if !self.shorthand {
|
||||
self.key.gen(p, ctx);
|
||||
}
|
||||
if self.computed {
|
||||
p.print(b']');
|
||||
}
|
||||
p.print_colon();
|
||||
if !self.shorthand {
|
||||
p.print_colon();
|
||||
}
|
||||
self.value.gen_expr(p, Precedence::Assign, Context::default());
|
||||
}
|
||||
}
|
||||
|
|
@ -2180,11 +2184,15 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for BindingProperty<'a> {
|
|||
if self.computed {
|
||||
p.print(b'[');
|
||||
}
|
||||
self.key.gen(p, ctx);
|
||||
if !self.shorthand {
|
||||
self.key.gen(p, ctx);
|
||||
}
|
||||
if self.computed {
|
||||
p.print(b']');
|
||||
}
|
||||
p.print(b':');
|
||||
if !self.shorthand {
|
||||
p.print_colon();
|
||||
}
|
||||
self.value.gen(p, ctx);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue