@@ -1859,10 +1859,8 @@ fn gen_assignment_expr<'a>(node: &'a AssignExpr, context: &mut Context<'a>) -> P
1859
1859
prefer_hanging : false ,
1860
1860
force_use_new_lines,
1861
1861
allow_blank_lines : false ,
1862
- single_line_space_at_start : false ,
1863
- single_line_space_at_end : false ,
1864
- single_line_separator : Signal :: SpaceOrNewLine . into ( ) ,
1865
- indent_width,
1862
+ indent_width : indent_width,
1863
+ single_line_options : ir_helpers:: SingleLineOptions :: separated_same_line ( Signal :: SpaceOrNewLine . into ( ) ) ,
1866
1864
multi_line_options : ir_helpers:: MultiLineOptions :: same_line_start_hanging_indent ( ) ,
1867
1865
force_possible_newline_at_start : false ,
1868
1866
} ,
@@ -2037,15 +2035,13 @@ fn gen_binary_expr<'a>(node: &'a BinExpr, context: &mut Context<'a>) -> PrintIte
2037
2035
prefer_hanging : false ,
2038
2036
force_use_new_lines,
2039
2037
allow_blank_lines : false ,
2040
- single_line_space_at_start : false ,
2041
- single_line_space_at_end : false ,
2042
- single_line_separator : if use_space_surrounding_operator {
2038
+ indent_width : indent_width,
2039
+ single_line_options : ir_helpers:: SingleLineOptions :: separated_same_line ( if use_space_surrounding_operator {
2043
2040
Signal :: SpaceOrNewLine . into ( )
2044
2041
} else {
2045
2042
PrintItems :: new ( )
2046
- } ,
2047
- indent_width,
2048
- multi_line_options,
2043
+ } ) ,
2044
+ multi_line_options : multi_line_options,
2049
2045
force_possible_newline_at_start : false ,
2050
2046
} ,
2051
2047
)
@@ -2818,9 +2814,7 @@ fn gen_sequence_expr<'a>(node: &'a SeqExpr, context: &mut Context<'a>) -> PrintI
2818
2814
force_use_new_lines : is_node_definitely_above_line_width ( node. range ( ) , context) ,
2819
2815
allow_blank_lines : false ,
2820
2816
separator : TrailingCommas :: Never . into ( ) ,
2821
- single_line_space_at_start : false ,
2822
- single_line_space_at_end : false ,
2823
- custom_single_line_separator : None ,
2817
+ single_line_options : ir_helpers:: SingleLineOptions :: same_line_maybe_space_separated ( ) ,
2824
2818
multi_line_options : ir_helpers:: MultiLineOptions :: same_line_start_hanging_indent ( ) ,
2825
2819
force_possible_newline_at_start : false ,
2826
2820
node_sorter : None ,
@@ -3683,9 +3677,7 @@ fn gen_jsx_opening_element<'a>(node: &'a JSXOpeningElement, context: &mut Contex
3683
3677
force_use_new_lines,
3684
3678
allow_blank_lines : false ,
3685
3679
separator : Separator :: none ( ) ,
3686
- single_line_space_at_start : true ,
3687
- single_line_space_at_end : false ,
3688
- custom_single_line_separator : None ,
3680
+ single_line_options : ir_helpers:: SingleLineOptions :: separated_line_starting_with_space ( ) ,
3689
3681
multi_line_options,
3690
3682
force_possible_newline_at_start : false ,
3691
3683
node_sorter : None ,
@@ -4639,10 +4631,8 @@ fn gen_for_stmt<'a>(node: &'a ForStmt, context: &mut Context<'a>) -> PrintItems
4639
4631
prefer_hanging : context. config . for_statement_prefer_hanging ,
4640
4632
force_use_new_lines,
4641
4633
allow_blank_lines : false ,
4642
- single_line_space_at_start : false ,
4643
- single_line_space_at_end : false ,
4644
- single_line_separator : separator_after_semi_colons. into ( ) ,
4645
4634
indent_width : context. config . indent_width ,
4635
+ single_line_options : ir_helpers:: SingleLineOptions :: separated_same_line ( separator_after_semi_colons. into ( ) ) ,
4646
4636
multi_line_options : ir_helpers:: MultiLineOptions :: same_line_no_indent ( ) ,
4647
4637
force_possible_newline_at_start : false ,
4648
4638
} ,
@@ -5175,9 +5165,7 @@ fn gen_var_decl<'a>(node: &'a VarDecl, context: &mut Context<'a>) -> PrintItems
5175
5165
force_use_new_lines,
5176
5166
allow_blank_lines : false ,
5177
5167
separator : TrailingCommas :: Never . into ( ) ,
5178
- single_line_space_at_start : false ,
5179
- single_line_space_at_end : false ,
5180
- custom_single_line_separator : None ,
5168
+ single_line_options : ir_helpers:: SingleLineOptions :: same_line_maybe_space_separated ( ) ,
5181
5169
multi_line_options : ir_helpers:: MultiLineOptions :: same_line_start_hanging_indent ( ) ,
5182
5170
force_possible_newline_at_start : false ,
5183
5171
node_sorter : None ,
@@ -5920,9 +5908,7 @@ fn gen_type_parameters<'a>(node: TypeParamNode<'a>, context: &mut Context<'a>) -
5920
5908
force_use_new_lines,
5921
5909
allow_blank_lines : false ,
5922
5910
separator : get_trailing_commas ( & node, context) . into ( ) ,
5923
- single_line_space_at_start : false ,
5924
- single_line_space_at_end : false ,
5925
- custom_single_line_separator : None ,
5911
+ single_line_options : ir_helpers:: SingleLineOptions :: same_line_maybe_space_separated ( ) ,
5926
5912
multi_line_options : ir_helpers:: MultiLineOptions :: surround_newlines_indented ( ) ,
5927
5913
force_possible_newline_at_start : false ,
5928
5914
node_sorter : None ,
@@ -6112,11 +6098,9 @@ fn gen_union_or_intersection_type<'a>(node: UnionOrIntersectionType<'a>, context
6112
6098
prefer_hanging,
6113
6099
force_use_new_lines,
6114
6100
allow_blank_lines : false ,
6115
- single_line_space_at_start : false ,
6116
- single_line_space_at_end : false ,
6117
- single_line_separator : Signal :: SpaceOrNewLine . into ( ) ,
6118
- indent_width,
6119
- multi_line_options,
6101
+ indent_width : indent_width,
6102
+ single_line_options : ir_helpers:: SingleLineOptions :: separated_same_line ( Signal :: SpaceOrNewLine . into ( ) ) ,
6103
+ multi_line_options : multi_line_options,
6120
6104
force_possible_newline_at_start : false ,
6121
6105
} ,
6122
6106
) ;
@@ -6671,9 +6655,11 @@ fn gen_array_like_nodes<'a>(opts: GenArrayLikeNodesOptions<'a>, context: &mut Co
6671
6655
force_use_new_lines,
6672
6656
allow_blank_lines : true ,
6673
6657
separator : trailing_commas. into ( ) ,
6674
- single_line_space_at_start : space_around,
6675
- single_line_space_at_end : space_around,
6676
- custom_single_line_separator : None ,
6658
+ single_line_options : SingleLineOptions {
6659
+ space_at_start : space_around,
6660
+ space_at_end : space_around,
6661
+ separator : Signal :: SpaceOrNewLine . into ( ) ,
6662
+ } ,
6677
6663
multi_line_options : ir_helpers:: MultiLineOptions :: surround_newlines_indented ( ) ,
6678
6664
force_possible_newline_at_start : false ,
6679
6665
node_sorter : None ,
@@ -7144,9 +7130,11 @@ where
7144
7130
force_use_new_lines,
7145
7131
allow_blank_lines : false ,
7146
7132
separator : trailing_commas. into ( ) ,
7147
- single_line_space_at_start : space_around,
7148
- single_line_space_at_end : space_around,
7149
- custom_single_line_separator : None ,
7133
+ single_line_options : SingleLineOptions {
7134
+ space_at_start : space_around,
7135
+ space_at_end : space_around,
7136
+ separator : Signal :: SpaceOrNewLine . into ( ) ,
7137
+ } ,
7150
7138
multi_line_options : if prefer_single_item_hanging {
7151
7139
MultiLineOptions :: maintain_line_breaks ( )
7152
7140
} else {
@@ -7374,9 +7362,7 @@ struct GenSeparatedValuesParams<'a> {
7374
7362
force_use_new_lines : bool ,
7375
7363
allow_blank_lines : bool ,
7376
7364
separator : Separator ,
7377
- single_line_space_at_start : bool ,
7378
- single_line_space_at_end : bool ,
7379
- custom_single_line_separator : Option < PrintItems > ,
7365
+ single_line_options : ir_helpers:: SingleLineOptions ,
7380
7366
multi_line_options : ir_helpers:: MultiLineOptions ,
7381
7367
force_possible_newline_at_start : bool ,
7382
7368
node_sorter : Option < Box < dyn Fn ( ( usize , Option < Node < ' a > > ) , ( usize , Option < Node < ' a > > ) , & Program < ' a > ) -> std:: cmp:: Ordering > > ,
@@ -7504,10 +7490,8 @@ fn gen_separated_values_with_result<'a>(opts: GenSeparatedValuesParams<'a>, cont
7504
7490
prefer_hanging : opts. prefer_hanging ,
7505
7491
force_use_new_lines : opts. force_use_new_lines ,
7506
7492
allow_blank_lines : opts. allow_blank_lines ,
7507
- single_line_space_at_start : opts. single_line_space_at_start ,
7508
- single_line_space_at_end : opts. single_line_space_at_end ,
7509
- single_line_separator : opts. custom_single_line_separator . unwrap_or_else ( || Signal :: SpaceOrNewLine . into ( ) ) ,
7510
- indent_width,
7493
+ indent_width : indent_width,
7494
+ single_line_options : opts. single_line_options ,
7511
7495
multi_line_options : opts. multi_line_options ,
7512
7496
force_possible_newline_at_start : opts. force_possible_newline_at_start ,
7513
7497
} ,
@@ -7753,9 +7737,7 @@ fn gen_extends_or_implements<'a>(opts: GenExtendsOrImplementsOptions<'a>, contex
7753
7737
force_use_new_lines : false ,
7754
7738
allow_blank_lines : false ,
7755
7739
separator : TrailingCommas :: Never . into ( ) ,
7756
- single_line_space_at_start : true ,
7757
- single_line_space_at_end : false ,
7758
- custom_single_line_separator : None ,
7740
+ single_line_options : ir_helpers:: SingleLineOptions :: separated_line_starting_with_space ( ) ,
7759
7741
multi_line_options : ir_helpers:: MultiLineOptions :: new_line_start ( ) ,
7760
7742
force_possible_newline_at_start : false ,
7761
7743
node_sorter : None ,
@@ -7809,9 +7791,11 @@ fn gen_object_like_node<'a>(opts: GenObjectLikeNodeOptions<'a>, context: &mut Co
7809
7791
force_use_new_lines : force_multi_line,
7810
7792
allow_blank_lines : opts. allow_blank_lines ,
7811
7793
separator : opts. separator ,
7812
- single_line_space_at_start : opts. surround_single_line_with_spaces ,
7813
- single_line_space_at_end : opts. surround_single_line_with_spaces ,
7814
- custom_single_line_separator : None ,
7794
+ single_line_options : ir_helpers:: SingleLineOptions {
7795
+ space_at_start : opts. surround_single_line_with_spaces ,
7796
+ space_at_end : opts. surround_single_line_with_spaces ,
7797
+ separator : Signal :: SpaceOrNewLine . into ( ) ,
7798
+ } ,
7815
7799
multi_line_options : ir_helpers:: MultiLineOptions :: surround_newlines_indented ( ) ,
7816
7800
force_possible_newline_at_start : false ,
7817
7801
node_sorter : opts. node_sorter ,
@@ -8015,9 +7999,11 @@ fn gen_decorators<'a>(decorators: &[&'a Decorator<'a>], is_inline: bool, context
8015
7999
force_use_new_lines,
8016
8000
allow_blank_lines : false ,
8017
8001
separator : Separator :: none ( ) ,
8018
- single_line_space_at_start : false ,
8019
- single_line_space_at_end : is_inline,
8020
- custom_single_line_separator : None ,
8002
+ single_line_options : ir_helpers:: SingleLineOptions {
8003
+ space_at_start : false ,
8004
+ space_at_end : is_inline,
8005
+ separator : Signal :: SpaceOrNewLine . into ( ) ,
8006
+ } ,
8021
8007
multi_line_options : ir_helpers:: MultiLineOptions :: same_line_no_indent ( ) ,
8022
8008
force_possible_newline_at_start : false ,
8023
8009
node_sorter : None ,
@@ -9128,10 +9114,12 @@ fn gen_surrounded_by_tokens<'a>(
9128
9114
prefer_hanging : false ,
9129
9115
force_use_new_lines : !is_single_line,
9130
9116
allow_blank_lines : true ,
9131
- single_line_space_at_start : opts. single_line_space_around ,
9132
- single_line_space_at_end : opts. single_line_space_around ,
9133
- single_line_separator : Signal :: SpaceOrNewLine . into ( ) ,
9134
- indent_width,
9117
+ indent_width : indent_width,
9118
+ single_line_options : SingleLineOptions {
9119
+ space_at_start : opts. single_line_space_around ,
9120
+ space_at_end : opts. single_line_space_around ,
9121
+ separator : Signal :: SpaceOrNewLine . into ( ) ,
9122
+ } ,
9135
9123
multi_line_options : ir_helpers:: MultiLineOptions :: surround_newlines_indented ( ) ,
9136
9124
force_possible_newline_at_start : false ,
9137
9125
} ,
0 commit comments