@@ -247,7 +247,6 @@ where
247247 restids : & mut Vec < Atom < ' data > > ,
248248 location_assigned : & mut bool ,
249249 ) {
250- dbg ! ( it) ;
251250 match & it. kind {
252251 BindingPatternKind :: BindingIdentifier ( p) => {
253252 // let a = 0;
@@ -445,7 +444,7 @@ where
445444 // do not walk further, we don't want to rewrite the identifiers
446445 }
447446
448- #[ cfg( feature = "debug" ) ]
447+ // #[cfg(feature = "debug")]
449448 fn visit_try_statement ( & mut self , it : & oxc:: ast:: ast:: TryStatement < ' data > ) {
450449 // for debugging we need to know what the error was
451450
@@ -459,7 +458,28 @@ where
459458 . add ( rewrite ! ( Span :: new( start, start) , ScramErr { ident } ) ) ;
460459 }
461460
462- walk:: walk_try_statement ( self , it) ;
461+ if !self . flags . destructure_rewrites {
462+ walk:: walk_try_statement ( self , it) ;
463+ return ;
464+ }
465+
466+ dbg ! ( & it) ;
467+ if let Some ( h) = & it. handler {
468+ if let Some ( p) = & h. param {
469+ let mut restids: Vec < Atom < ' data > > = Vec :: new ( ) ;
470+ let mut location_assigned: bool = false ;
471+
472+ self . recurse_binding_pattern ( & p. pattern , & mut restids, & mut location_assigned) ;
473+ self . jschanges . add ( rewrite ! (
474+ h. body. body[ 0 ] . span( ) ,
475+ CleanFunction {
476+ restids,
477+ expression: false ,
478+ }
479+ ) ) ;
480+ }
481+ }
482+
463483 }
464484
465485 fn visit_object_expression ( & mut self , it : & ObjectExpression < ' data > ) {
0 commit comments