@@ -222,7 +222,7 @@ impl<'p, 'ctx> MutSelfTypedResultWalker<'ctx> for Printer<'p> {
222222 }
223223 if let Some ( index_signature) = & schema_stmt. index_signature {
224224 self . fill ( "" ) ;
225- self . write_ast_comments ( index_signature) ;
225+ self . write_comments_before_node ( index_signature) ;
226226 self . write_token ( TokenKind :: OpenDelim ( DelimToken :: Bracket ) ) ;
227227 if index_signature. node . any_other {
228228 self . write_token ( TokenKind :: DotDotDot ) ;
@@ -893,7 +893,7 @@ impl<'p> Printer<'p> {
893893 match & key. node {
894894 ast:: Expr :: Identifier ( identifier) => {
895895 self . hook . pre ( self , super :: ASTNode :: Expr ( key) ) ;
896- self . write_ast_comments ( key) ;
896+ self . write_comments_before_node ( key) ;
897897 // Judge contains string or dot identifier, e.g., "x-y-z" and "a.b.c"
898898 let names = & identifier. names ;
899899
@@ -940,15 +940,15 @@ impl<'p> Printer<'p> {
940940
941941 pub fn expr ( & mut self , expr : & ast:: NodeRef < ast:: Expr > ) {
942942 self . hook . pre ( self , super :: ASTNode :: Expr ( expr) ) ;
943- self . write_ast_comments ( expr) ;
943+ self . update_last_ast_line ( expr) ;
944944 self . walk_expr ( & expr. node ) ;
945945 self . hook . post ( self , super :: ASTNode :: Expr ( expr) ) ;
946946 }
947947
948948 pub fn stmt ( & mut self , stmt : & ast:: NodeRef < ast:: Stmt > ) {
949949 self . hook . pre ( self , super :: ASTNode :: Stmt ( stmt) ) ;
950950 self . fill ( "" ) ;
951- self . write_ast_comments ( stmt) ;
951+ self . write_comments_before_node ( stmt) ;
952952 self . walk_stmt ( & stmt. node ) ;
953953 self . hook . post ( self , super :: ASTNode :: Stmt ( stmt) ) ;
954954 }
0 commit comments