Commit e3b64a0 1 parent 49fccba commit e3b64a0 Copy full SHA for e3b64a0
File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1812,12 +1812,18 @@ impl<'a> Emitter<'a> {
1812
1812
fn emit_object_pat ( & mut self , node : & ObjectPat ) -> Result {
1813
1813
self . emit_leading_comments_of_pos ( node. span ( ) . lo ( ) , false ) ?;
1814
1814
1815
+ let is_last_rest = match node. props . last ( ) {
1816
+ Some ( ObjectPatProp :: Rest ( ..) ) => true ,
1817
+ _ => false ,
1818
+ } ;
1819
+ let format = if is_last_rest {
1820
+ ListFormat :: ObjectBindingPatternElements ^ ListFormat :: AllowTrailingComma
1821
+ } else {
1822
+ ListFormat :: ObjectBindingPatternElements
1823
+ } ;
1824
+
1815
1825
punct ! ( "{" ) ;
1816
- self . emit_list (
1817
- node. span ( ) ,
1818
- Some ( & node. props ) ,
1819
- ListFormat :: ObjectBindingPatternElements ,
1820
- ) ?;
1826
+ self . emit_list ( node. span ( ) , Some ( & node. props ) , format) ?;
1821
1827
punct ! ( "}" ) ;
1822
1828
if node. optional {
1823
1829
punct ! ( "?" ) ;
You can’t perform that action at this time.
0 commit comments