@@ -4287,7 +4287,15 @@ fn gen_do_while_stmt<'a>(node: &'a DoWhileStmt, context: &mut Context<'a>) -> Pr
42874287 context,
42884288 ) ) ;
42894289 items. extend ( gen_node ( node. body . into ( ) , context) ) ;
4290- items. push_str ( " while" ) ;
4290+ items. extend ( gen_control_flow_separator (
4291+ context. config . do_while_statement_next_control_flow_position ,
4292+ & node. body . range ( ) ,
4293+ "while" ,
4294+ None ,
4295+ None ,
4296+ context,
4297+ ) ) ;
4298+ items. push_str ( "while" ) ;
42914299 if context. config . do_while_statement_space_after_while_keyword {
42924300 items. push_str ( " " ) ;
42934301 }
@@ -4738,7 +4746,7 @@ fn gen_if_stmt<'a>(node: &'a IfStmt, context: &mut Context<'a>) -> PrintItems {
47384746 context. config . if_statement_next_control_flow_position ,
47394747 & cons_range,
47404748 "else" ,
4741- if_stmt_start_ln,
4749+ Some ( if_stmt_start_ln) ,
47424750 Some ( result. close_brace_condition_ref ) ,
47434751 context,
47444752 ) ) ;
@@ -4995,7 +5003,7 @@ fn gen_try_stmt<'a>(node: &'a TryStmt, context: &mut Context<'a>) -> PrintItems
49955003 next_control_flow_position,
49965004 & last_block_range,
49975005 "catch" ,
4998- last_block_start_ln,
5006+ Some ( last_block_start_ln) ,
49995007 None ,
50005008 context,
50015009 ) ) ;
@@ -5011,7 +5019,7 @@ fn gen_try_stmt<'a>(node: &'a TryStmt, context: &mut Context<'a>) -> PrintItems
50115019 next_control_flow_position,
50125020 & last_block_range,
50135021 "finally" ,
5014- last_block_start_ln,
5022+ Some ( last_block_start_ln) ,
50155023 None ,
50165024 context,
50175025 ) ) ;
@@ -7892,7 +7900,7 @@ fn gen_control_flow_separator(
78927900 next_control_flow_position : NextControlFlowPosition ,
78937901 previous_node_block : & SourceRange ,
78947902 token_text : & str ,
7895- previous_start_ln : LineNumber ,
7903+ previous_start_ln : Option < LineNumber > ,
78967904 previous_close_brace_condition_ref : Option < ConditionReference > ,
78977905 context : & mut Context ,
78987906) -> PrintItems {
@@ -7903,8 +7911,10 @@ fn gen_control_flow_separator(
79037911 "newLineOrSpace" ,
79047912 Rc :: new ( move |condition_context| {
79057913 // newline if on the same line as the previous
7906- if condition_helpers:: is_on_same_line ( condition_context, previous_start_ln) ? {
7907- return Some ( true ) ;
7914+ if let Some ( previous_start_ln) = previous_start_ln {
7915+ if condition_helpers:: is_on_same_line ( condition_context, previous_start_ln) ? {
7916+ return Some ( true ) ;
7917+ }
79087918 }
79097919
79107920 // newline if the previous did not have a close brace
0 commit comments