@@ -1474,7 +1474,7 @@ fn gen_using_decl<'a>(node: &UsingDecl<'a>, context: &mut Context<'a>) -> PrintI
14741474
14751475 items. extend ( gen_var_declarators ( node. into ( ) , node. decls , context) ) ;
14761476
1477- if context . config . semi_colons . is_true ( ) {
1477+ if requires_semi_colon_for_var_or_using_decl ( node . into ( ) , context ) {
14781478 items. push_sc ( sc ! ( ";" ) ) ;
14791479 }
14801480
@@ -5343,22 +5343,22 @@ fn gen_var_decl<'a>(node: &VarDecl<'a>, context: &mut Context<'a>) -> PrintItems
53435343
53445344 items. extend ( gen_var_declarators ( node. into ( ) , node. decls , context) ) ;
53455345
5346- if requires_semi_colon ( node, context) {
5346+ if requires_semi_colon_for_var_or_using_decl ( node. into ( ) , context) {
53475347 items. push_sc ( sc ! ( ";" ) ) ;
53485348 }
53495349
5350- return items;
5350+ items
5351+ }
53515352
5352- fn requires_semi_colon ( node : & VarDecl , context : & mut Context ) -> bool {
5353- let use_semi_colons = context. config . semi_colons . is_true ( ) ;
5354- use_semi_colons
5355- && match node. parent ( ) {
5356- Node :: ForInStmt ( node) => node. start ( ) >= node. body . start ( ) ,
5357- Node :: ForOfStmt ( node) => node. start ( ) >= node. body . start ( ) ,
5358- Node :: ForStmt ( node) => node. start ( ) >= node. body . start ( ) ,
5359- _ => use_semi_colons,
5360- }
5361- }
5353+ fn requires_semi_colon_for_var_or_using_decl ( node : Node , context : & mut Context ) -> bool {
5354+ let use_semi_colons = context. config . semi_colons . is_true ( ) ;
5355+ use_semi_colons
5356+ && match node. parent ( ) {
5357+ Some ( Node :: ForInStmt ( node) ) => node. start ( ) >= node. body . start ( ) ,
5358+ Some ( Node :: ForOfStmt ( node) ) => node. start ( ) >= node. body . start ( ) ,
5359+ Some ( Node :: ForStmt ( node) ) => node. start ( ) >= node. body . start ( ) ,
5360+ _ => use_semi_colons,
5361+ }
53625362}
53635363
53645364fn gen_var_declarators < ' a > ( parent : Node < ' a > , decls : & [ & ' a VarDeclarator < ' a > ] , context : & mut Context < ' a > ) -> PrintItems {
0 commit comments