File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,9 @@ const isCommentOrWhiteSpace = createKindCheckFunction([
2121function getLeadingOffset ( children : Node [ ] ) : number {
2222 let offset = 0 ;
2323 for ( const child of children ) {
24- if ( child . isNonterminalNode ( ) ) {
25- // The node's content starts when we find the first non-terminal token.
26- return offset ;
27- } else if ( ! isCommentOrWhiteSpace ( child ) ) {
28- // The content of the node started if we find a non-comment,
29- // non-whitespace token.
24+ if ( child . isNonterminalNode ( ) || ! isCommentOrWhiteSpace ( child ) ) {
25+ // The node's content starts when we find the first non-terminal token,
26+ // or if we find a non-comment, non-whitespace token.
3027 return offset ;
3128 }
3229 offset += child . textLength . utf16 ;
@@ -110,7 +107,8 @@ function collectComments(
110107 if ( node ) {
111108 if ( Array . isArray ( node ) ) {
112109 return node . reduce ( collectComments , comments ) ;
113- } else if ( node . comments . length > 0 ) {
110+ }
111+ if ( node . comments . length > 0 ) {
114112 comments . push ( ...node . comments . splice ( 0 ) ) ;
115113 }
116114 }
You can’t perform that action at this time.
0 commit comments