@@ -14,7 +14,6 @@ import { locStart, locEnd } from "./loc.js";
1414import {
1515 getLast ,
1616 getPenultimate ,
17- isLastStatement ,
1817 lineShouldEndWithSemicolon ,
1918 printNumber ,
2019 shouldFlatten ,
@@ -36,7 +35,6 @@ import {
3635 isDocNode ,
3736 getAncestorNode ,
3837 isReferenceLikeNode ,
39- getNextNode ,
4038 normalizeMagicMethodName ,
4139} from "./util.js" ;
4240
@@ -934,7 +932,7 @@ function printLines(path, options, print, childrenAttribute = "children") {
934932 const isInlineNode = childNode . kind === "inline" ;
935933 const printedPath = print ( ) ;
936934 const canPrintBlankLine =
937- ! isLastStatement ( path ) &&
935+ ! isLastNode &&
938936 ! isInlineNode &&
939937 ( nextNode && nextNode . kind === "case"
940938 ? ! isFirstChildrenInlineNode ( path )
@@ -1102,15 +1100,15 @@ function printLines(path, options, print, childrenAttribute = "children") {
11021100}
11031101
11041102function printStatements ( path , options , print , childrenAttribute ) {
1105- return path . map ( ( ) => {
1103+ return path . map ( ( { node , isLast } ) => {
11061104 const parts = [ ] ;
11071105
11081106 parts . push ( print ( ) ) ;
11091107
1110- if ( ! isLastStatement ( path ) ) {
1108+ if ( ! isLast ) {
11111109 parts . push ( hardline ) ;
11121110
1113- if ( isNextLineEmpty ( options . originalText , locEnd ( path . node ) ) ) {
1111+ if ( isNextLineEmpty ( options . originalText , locEnd ( node ) ) ) {
11141112 parts . push ( hardline ) ;
11151113 }
11161114 }
@@ -1607,13 +1605,11 @@ function printNode(path, options, print) {
16071605 ] ;
16081606 }
16091607
1610- const nextNode = getNextNode ( path , node ) ;
1611-
16121608 return [
16131609 "declare(" ,
16141610 printDeclareArguments ( path ) ,
16151611 ")" ,
1616- nextNode && nextNode . kind === "inline" ? "" : ";" ,
1612+ path . next ? .kind === "inline" ? "" : ";" ,
16171613 ] ;
16181614 }
16191615 case "declaredirective" :
0 commit comments