@@ -945,10 +945,11 @@ impl Gen for ImportAttribute<'_> {
945
945
impl Gen for ExportNamedDeclaration < ' _ > {
946
946
fn r#gen ( & self , p : & mut Codegen , ctx : Context ) {
947
947
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 ) ;
952
953
}
953
954
p. add_source_mapping ( self . span ) ;
954
955
p. print_indent ( ) ;
@@ -1092,10 +1093,11 @@ impl Gen for ExportAllDeclaration<'_> {
1092
1093
impl Gen for ExportDefaultDeclaration < ' _ > {
1093
1094
fn r#gen ( & self , p : & mut Codegen , ctx : Context ) {
1094
1095
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 ) ;
1099
1101
}
1100
1102
p. add_source_mapping ( self . span ) ;
1101
1103
p. print_indent ( ) ;
@@ -1586,23 +1588,22 @@ impl Gen for ObjectProperty<'_> {
1586
1588
if let PropertyKey :: StaticIdentifier ( key) = & self . key {
1587
1589
if key. name == "__proto__" {
1588
1590
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 ;
1593
1595
}
1594
1596
}
1595
1597
1596
1598
let mut computed = self . computed ;
1597
1599
1598
1600
// "{ -1: 0 }" must be printed as "{ [-1]: 0 }"
1599
1601
// "{ 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 ;
1606
1607
}
1607
1608
1608
1609
if !shorthand {
@@ -2811,10 +2812,9 @@ impl Gen for BindingProperty<'_> {
2811
2812
BindingPatternKind :: AssignmentPattern ( assignment_pattern) => {
2812
2813
if let BindingPatternKind :: BindingIdentifier ( ident) =
2813
2814
& assignment_pattern. left . kind
2815
+ && key. name == p. get_binding_identifier_name ( ident)
2814
2816
{
2815
- if key. name == p. get_binding_identifier_name ( ident) {
2816
- shorthand = true ;
2817
- }
2817
+ shorthand = true ;
2818
2818
}
2819
2819
}
2820
2820
_ => { }
@@ -3205,12 +3205,12 @@ impl Gen for TSTemplateLiteralType<'_> {
3205
3205
fn r#gen ( & self , p : & mut Codegen , ctx : Context ) {
3206
3206
p. print_str ( "`" ) ;
3207
3207
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 ( "}" ) ;
3214
3214
}
3215
3215
p. print_str ( item. value . raw . as_str ( ) ) ;
3216
3216
}
0 commit comments