@@ -10,6 +10,7 @@ import slangPrint from './slangPrinter.js';
1010import { isBlockComment , isComment } from './slang-utils/is-comment.js' ;
1111import { locEnd , locStart } from './slang-utils/loc.js' ;
1212import { hasPrettierIgnore } from './slang-utils/has-prettier-ignore.js' ;
13+ import { getVisitorKeys } from './slang-utils/get-visitor-keys.js' ;
1314
1415import type {
1516 AstPath ,
@@ -57,10 +58,9 @@ const parsers = {
5758
5859const antlrCanAttachComment = ( { type } : { type : string } ) : boolean =>
5960 typeof type === 'string' && type !== 'BlockComment' && type !== 'LineComment' ;
60- const canAttachComment = ( node : PrintableNode | undefined ) : boolean =>
61- node !== undefined &&
62- node . kind && // Make sure it's not Location
63- ! isComment ( node ) ;
61+ const canAttachComment = ( node : PrintableNode ) : boolean =>
62+ // Make sure it's not Location
63+ node . kind && ! isComment ( node ) ;
6464
6565// https://prettier.io/docs/en/plugins.html#printers
6666const antlrPrinter = {
@@ -75,18 +75,19 @@ const antlrPrinter = {
7575 print : antlrPrint ,
7676 printComment : comments . printComment
7777} ;
78- const slangPrinter : Printer < PrintableNode | undefined > = {
78+ const slangPrinter : Printer < PrintableNode > = {
7979 canAttachComment,
8080 handleComments,
8181 isBlockComment,
8282 massageAstNode,
8383 print : slangPrint as (
84- path : AstPath < PrintableNode | undefined > ,
85- options : ParserOptions < PrintableNode | undefined > ,
86- print : ( path : AstPath < PrintableNode | undefined > ) => Doc ,
84+ path : AstPath < PrintableNode > ,
85+ options : ParserOptions < PrintableNode > ,
86+ print : ( path : AstPath < PrintableNode > ) => Doc ,
8787 args ?: unknown
8888 ) => Doc ,
8989 hasPrettierIgnore,
90+ getVisitorKeys,
9091 printComment
9192} ;
9293
0 commit comments