File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ const antlrCanAttachComment = ({ type }: { type: string }): boolean =>
5555 typeof type === 'string' && type !== 'BlockComment' && type !== 'LineComment' ;
5656const canAttachComment = ( node : AstNode ) : boolean =>
5757 typeof node !== 'string' &&
58- typeof node !== ' undefined' &&
58+ node !== undefined &&
5959 node . kind && // Make sure it's not Location
6060 ! isComment ( node ) ;
6161
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ export class ContractSpecifiers extends SlangNode {
2828 print ( path : AstPath < ContractSpecifiers > , print : PrintFunction ) : Doc {
2929 const [ specifier1 , specifier2 ] = path . map ( print , 'items' ) ;
3030
31- if ( typeof specifier1 === ' undefined' ) return '' ;
31+ if ( specifier1 === undefined ) return '' ;
3232
33- if ( typeof specifier2 === ' undefined' ) return [ ' ' , specifier1 ] ;
33+ if ( specifier2 === undefined ) return [ ' ' , specifier1 ] ;
3434
3535 const groupId = Symbol ( 'Slang.ContractSpecifiers.inheritance' ) ;
3636 return printSeparatedList (
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ export class SlangNode {
126126 // calculate correct loc object
127127 if ( loc . leadingOffset === 0 ) {
128128 for ( const childNode of childNodes ) {
129- if ( typeof childNode === ' undefined' ) continue ;
129+ if ( childNode === undefined ) continue ;
130130 const { leadingOffset, start } = childNode . loc ;
131131
132132 if ( start - leadingOffset === loc . start ) {
@@ -139,7 +139,7 @@ export class SlangNode {
139139
140140 if ( loc . trailingOffset === 0 ) {
141141 for ( const childNode of reversedIterator ( childNodes ) ) {
142- if ( typeof childNode === ' undefined' ) continue ;
142+ if ( childNode === undefined ) continue ;
143143 const { trailingOffset, end } = childNode . loc ;
144144
145145 if ( end + trailingOffset === loc . end ) {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export function printComments(
2020 path : AstPath < StrictAstNode > ,
2121 options : ParserOptions < AstNode >
2222) : Doc [ ] {
23- if ( typeof path . node . comments === ' undefined' ) return [ ] ;
23+ if ( path . node . comments === undefined ) return [ ] ;
2424 return joinExisting (
2525 line ,
2626 path . map ( ( commentPath , index , comments : Comment [ ] ) => {
Original file line number Diff line number Diff line change 11import type { AstNode } from '../slang-nodes/types.d.ts' ;
22
33export function locStart ( node : AstNode ) : number {
4- if ( typeof node === 'string' || typeof node === ' undefined' ) return - 1 ;
4+ if ( typeof node === 'string' || node === undefined ) return - 1 ;
55 return node . loc . start ;
66}
77
88export function locEnd ( node : AstNode ) : number {
9- if ( typeof node === 'string' || typeof node === ' undefined' ) return - 1 ;
9+ if ( typeof node === 'string' || node === undefined ) return - 1 ;
1010 return node . loc . end ;
1111}
You can’t perform that action at this time.
0 commit comments