File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export default function handleElseBranchComments({
1111 followingNode,
1212 comment
1313} : HandlerParams ) : boolean {
14- if ( enclosingNode ?. kind !== NonterminalKind . ElseBranch || ! followingNode ) {
14+ if ( enclosingNode ?. kind !== NonterminalKind . ElseBranch ) {
1515 return false ;
1616 }
1717
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default function handleIfStatementComments({
1414 followingNode,
1515 comment
1616} : HandlerParams ) : boolean {
17- if ( enclosingNode ?. kind !== NonterminalKind . IfStatement || ! followingNode ) {
17+ if ( enclosingNode ?. kind !== NonterminalKind . IfStatement ) {
1818 return false ;
1919 }
2020
@@ -43,7 +43,7 @@ export default function handleIfStatementComments({
4343 return true ;
4444 }
4545
46- if ( followingNode . kind === NonterminalKind . IfStatement ) {
46+ if ( followingNode ? .kind === NonterminalKind . IfStatement ) {
4747 if ( followingNode . body . kind === NonterminalKind . Block ) {
4848 addCollectionFirstComment ( followingNode . body . statements , comment ) ;
4949 } else {
Original file line number Diff line number Diff line change @@ -14,10 +14,7 @@ export default function handleWhileStatementComments({
1414 followingNode,
1515 comment
1616} : HandlerParams ) : boolean {
17- if (
18- enclosingNode ?. kind !== NonterminalKind . WhileStatement ||
19- ! followingNode
20- ) {
17+ if ( enclosingNode ?. kind !== NonterminalKind . WhileStatement ) {
2118 return false ;
2219 }
2320
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export abstract class SlangNode {
4444 enclosePeripheralComments = false
4545 ) {
4646 if ( ast instanceof SlangTerminalNode ) {
47- const start = collected . offsets . get ( ast . id ) || 0 ;
47+ const start = collected . offsets . get ( ast . id ) ?? 0 ;
4848 const end = start + ast . textLength . utf16 ;
4949 this . loc = {
5050 outerStart : start ,
@@ -56,7 +56,7 @@ export abstract class SlangNode {
5656 }
5757 const cst = ast . cst ;
5858
59- const initialOffset = collected . offsets . get ( cst . id ) || 0 ;
59+ const initialOffset = collected . offsets . get ( cst . id ) ?? 0 ;
6060 let offset = initialOffset ;
6161 let triviaLength = 0 ;
6262 let leadingOffset ;
You can’t perform that action at this time.
0 commit comments