@@ -945,10 +945,11 @@ impl Gen for ImportAttribute<'_> {
945945impl Gen for ExportNamedDeclaration < ' _ > {
946946 fn r#gen ( & self , p : & mut Codegen , ctx : Context ) {
947947 p. print_comments_at ( self . span . start ) ;
948- if let Some ( Declaration :: FunctionDeclaration ( func) ) = & self . declaration {
949- if func. pure && p. options . print_annotation_comment ( ) {
950- p. print_str ( NO_SIDE_EFFECTS_NEW_LINE_COMMENT ) ;
951- }
948+ if let Some ( Declaration :: FunctionDeclaration ( func) ) = & self . declaration
949+ && func. pure
950+ && p. options . print_annotation_comment ( )
951+ {
952+ p. print_str ( NO_SIDE_EFFECTS_NEW_LINE_COMMENT ) ;
952953 }
953954 p. add_source_mapping ( self . span ) ;
954955 p. print_indent ( ) ;
@@ -1092,10 +1093,11 @@ impl Gen for ExportAllDeclaration<'_> {
10921093impl Gen for ExportDefaultDeclaration < ' _ > {
10931094 fn r#gen ( & self , p : & mut Codegen , ctx : Context ) {
10941095 p. print_comments_at ( self . span . start ) ;
1095- if let ExportDefaultDeclarationKind :: FunctionDeclaration ( func) = & self . declaration {
1096- if func. pure && p. options . print_annotation_comment ( ) {
1097- p. print_str ( NO_SIDE_EFFECTS_NEW_LINE_COMMENT ) ;
1098- }
1096+ if let ExportDefaultDeclarationKind :: FunctionDeclaration ( func) = & self . declaration
1097+ && func. pure
1098+ && p. options . print_annotation_comment ( )
1099+ {
1100+ p. print_str ( NO_SIDE_EFFECTS_NEW_LINE_COMMENT ) ;
10991101 }
11001102 p. add_source_mapping ( self . span ) ;
11011103 p. print_indent ( ) ;
@@ -1586,23 +1588,22 @@ impl Gen for ObjectProperty<'_> {
15861588 if let PropertyKey :: StaticIdentifier ( key) = & self . key {
15871589 if key. name == "__proto__" {
15881590 shorthand = self . shorthand ;
1589- } else if let Expression :: Identifier ( ident) = self . value . without_parentheses ( ) {
1590- if key. name == p. get_identifier_reference_name ( ident) {
1591- shorthand = true ;
1592- }
1591+ } else if let Expression :: Identifier ( ident) = self . value . without_parentheses ( )
1592+ && key. name == p. get_identifier_reference_name ( ident)
1593+ {
1594+ shorthand = true ;
15931595 }
15941596 }
15951597
15961598 let mut computed = self . computed ;
15971599
15981600 // "{ -1: 0 }" must be printed as "{ [-1]: 0 }"
15991601 // "{ 1/0: 0 }" must be printed as "{ [1/0]: 0 }"
1600- if !computed {
1601- if let Some ( Expression :: NumericLiteral ( n) ) = self . key . as_expression ( ) {
1602- if n. value . is_sign_negative ( ) || n. value . is_infinite ( ) {
1603- computed = true ;
1604- }
1605- }
1602+ if !computed
1603+ && let Some ( Expression :: NumericLiteral ( n) ) = self . key . as_expression ( )
1604+ && ( n. value . is_sign_negative ( ) || n. value . is_infinite ( ) )
1605+ {
1606+ computed = true ;
16061607 }
16071608
16081609 if !shorthand {
@@ -2811,10 +2812,9 @@ impl Gen for BindingProperty<'_> {
28112812 BindingPatternKind :: AssignmentPattern ( assignment_pattern) => {
28122813 if let BindingPatternKind :: BindingIdentifier ( ident) =
28132814 & assignment_pattern. left . kind
2815+ && key. name == p. get_binding_identifier_name ( ident)
28142816 {
2815- if key. name == p. get_binding_identifier_name ( ident) {
2816- shorthand = true ;
2817- }
2817+ shorthand = true ;
28182818 }
28192819 }
28202820 _ => { }
@@ -3205,12 +3205,12 @@ impl Gen for TSTemplateLiteralType<'_> {
32053205 fn r#gen ( & self , p : & mut Codegen , ctx : Context ) {
32063206 p. print_str ( "`" ) ;
32073207 for ( index, item) in self . quasis . iter ( ) . enumerate ( ) {
3208- if index != 0 {
3209- if let Some ( types) = self . types . get ( index - 1 ) {
3210- p . print_str ( "${" ) ;
3211- types . print ( p , ctx ) ;
3212- p . print_str ( "}" ) ;
3213- }
3208+ if index != 0
3209+ && let Some ( types) = self . types . get ( index - 1 )
3210+ {
3211+ p . print_str ( "${" ) ;
3212+ types . print ( p , ctx ) ;
3213+ p . print_str ( "}" ) ;
32143214 }
32153215 p. print_str ( item. value . raw . as_str ( ) ) ;
32163216 }
0 commit comments