@@ -25,13 +25,13 @@ import {
2525 CommentInfo ,
2626} from './nodes' ;
2727import { blockElements , TagName } from '../lib/elements' ;
28- import { FastPath } from 'prettier' ;
28+ import { AstPath } from 'prettier' ;
2929import { findLastIndex , isASTNode , isPreTagContent } from './helpers' ;
3030import { ParserOptions , isBracketSameLine } from '../options' ;
3131
3232const unsupportedLanguages = [ 'coffee' , 'coffeescript' , 'styl' , 'stylus' , 'sass' ] ;
3333
34- export function isInlineElement ( path : FastPath , options : ParserOptions , node : Node ) {
34+ export function isInlineElement ( path : AstPath , options : ParserOptions , node : Node ) {
3535 return (
3636 node && node . type === 'Element' && ! isBlockElement ( node , options ) && ! isPreTagContent ( path )
3737 ) ;
@@ -82,7 +82,7 @@ export function getChildren(node: Node): Node[] {
8282/**
8383 * Returns siblings, that is, the children of the parent.
8484 */
85- export function getSiblings ( path : FastPath ) : Node [ ] {
85+ export function getSiblings ( path : AstPath ) : Node [ ] {
8686 let parent : Node = path . getParentNode ( ) ;
8787
8888 if ( isASTNode ( parent ) ) {
@@ -95,22 +95,22 @@ export function getSiblings(path: FastPath): Node[] {
9595/**
9696 * Returns the previous sibling node.
9797 */
98- export function getPreviousNode ( path : FastPath ) : Node | undefined {
98+ export function getPreviousNode ( path : AstPath ) : Node | undefined {
9999 const node : Node = path . getNode ( ) ;
100100 return getSiblings ( path ) . find ( ( child ) => child . end === node . start ) ;
101101}
102102
103103/**
104104 * Returns the next sibling node.
105105 */
106- export function getNextNode ( path : FastPath , node : Node = path . getNode ( ) ) : Node | undefined {
106+ export function getNextNode ( path : AstPath , node : Node = path . getNode ( ) ) : Node | undefined {
107107 return getSiblings ( path ) . find ( ( child ) => child . start === node . end ) ;
108108}
109109
110110/**
111111 * Returns the comment that is above the current node.
112112 */
113- export function getLeadingComment ( path : FastPath ) : CommentNode | undefined {
113+ export function getLeadingComment ( path : AstPath ) : CommentNode | undefined {
114114 const siblings = getSiblings ( path ) ;
115115
116116 let node : Node = path . getNode ( ) ;
@@ -135,7 +135,7 @@ export function getLeadingComment(path: FastPath): CommentNode | undefined {
135135 * Did there use to be any embedded object (that has been snipped out of the AST to be moved)
136136 * at the specified position?
137137 */
138- export function doesEmbedStartAfterNode ( node : Node , path : FastPath , siblings = getSiblings ( path ) ) {
138+ export function doesEmbedStartAfterNode ( node : Node , path : AstPath , siblings = getSiblings ( path ) ) {
139139 // If node is not at the top level of html, an embed cannot start after it,
140140 // because embeds are only at the top level
141141 if ( ! isNodeTopLevelHTML ( node , path ) ) {
@@ -151,7 +151,7 @@ export function doesEmbedStartAfterNode(node: Node, path: FastPath, siblings = g
151151 return embeds . find ( ( n ) => n && n . start >= position && ( ! nextNode || n . end <= nextNode . start ) ) ;
152152}
153153
154- export function isNodeTopLevelHTML ( node : Node , path : FastPath ) : boolean {
154+ export function isNodeTopLevelHTML ( node : Node , path : AstPath ) : boolean {
155155 const root = path . stack [ 0 ] ;
156156 return ! ! root . html && ! ! root . html . children && root . html . children . includes ( node ) ;
157157}
@@ -355,7 +355,7 @@ export function trimTextNodeLeft(node: TextNode): void {
355355 * Remove all leading whitespace up until the first non-empty text node,
356356 * and all trailing whitespace from the last non-empty text node onwards.
357357 */
358- export function trimChildren ( children : Node [ ] , path : FastPath ) : void {
358+ export function trimChildren ( children : Node [ ] , path : AstPath ) : void {
359359 let firstNonEmptyNode = children . findIndex (
360360 ( n ) => ! isEmptyTextNode ( n ) && ! doesEmbedStartAfterNode ( n , path ) ,
361361 ) ;
@@ -528,7 +528,7 @@ export function checkWhitespaceAtEndOfSvelteBlock(
528528 return 'none' ;
529529}
530530
531- export function isInsideQuotedAttribute ( path : FastPath , options : ParserOptions ) : boolean {
531+ export function isInsideQuotedAttribute ( path : AstPath , options : ParserOptions ) : boolean {
532532 const stack = path . stack as Node [ ] ;
533533
534534 return stack . some (
@@ -544,7 +544,7 @@ export function isInsideQuotedAttribute(path: FastPath, options: ParserOptions):
544544 */
545545export function canOmitSoftlineBeforeClosingTag (
546546 node : Node ,
547- path : FastPath ,
547+ path : AstPath ,
548548 options : ParserOptions ,
549549) : boolean {
550550 return (
@@ -566,7 +566,7 @@ function hugsStartOfNextNode(node: Node, options: ParserOptions): boolean {
566566 return ! options . originalText . substring ( node . end ) . match ( / ^ \s / ) ;
567567}
568568
569- function isLastChildWithinParentBlockElement ( path : FastPath , options : ParserOptions ) : boolean {
569+ function isLastChildWithinParentBlockElement ( path : AstPath , options : ParserOptions ) : boolean {
570570 const parent = path . getParentNode ( ) as Node | undefined ;
571571 if ( ! parent || ! isBlockElement ( parent , options ) ) {
572572 return false ;
0 commit comments