@@ -29,32 +29,7 @@ const defaultArrayCallMethodNames = new Set<string>([
2929 "flatMap" ,
3030] ) ;
3131
32- const defaultArrayPropertyNames = new Set < string > ( [
33- "length" ,
34- ] ) ;
35-
3632export class TSHelper {
37- // Reverse lookup of enum key by value
38- public static enumName < T > ( needle : T , haystack : any ) : string {
39- for ( const name in haystack ) {
40- if ( haystack [ name ] === needle ) {
41- return name ;
42- }
43- }
44- return "unknown" ;
45- }
46-
47- // Breaks down a mask into all flag names.
48- public static enumNames < T > ( mask : number , haystack : any ) : string [ ] {
49- const result = [ ] ;
50- for ( const name in haystack ) {
51- if ( ( mask & haystack [ name ] ) !== 0 && mask >= haystack [ name ] ) {
52- result . push ( name ) ;
53- }
54- }
55- return result ;
56- }
57-
5833 public static getExtendedTypeNode ( node : ts . ClassLikeDeclarationBase , checker : ts . TypeChecker ) :
5934 ts . ExpressionWithTypeArguments | undefined {
6035 if ( node && node . heritageClauses ) {
@@ -353,21 +328,6 @@ export class TSHelper {
353328 return [ false , undefined ] ;
354329 }
355330
356- public static isExpressionStatement ( node : ts . Expression ) : boolean {
357- return node . parent === undefined || ts . isExpressionStatement ( node . parent ) || ts . isForStatement ( node . parent ) ;
358- }
359-
360- public static isInGlobalScope ( node : ts . Node ) : boolean {
361- let parent = node . parent ;
362- while ( parent !== undefined ) {
363- if ( ts . isBlock ( parent ) ) {
364- return false ;
365- }
366- parent = parent . parent ;
367- }
368- return true ;
369- }
370-
371331 // Returns true for expressions that may have effects when evaluated
372332 public static isExpressionWithEvaluationEffect ( node : ts . Expression ) : boolean {
373333 return ! ( ts . isLiteralExpression ( node ) || ts . isIdentifier ( node ) || node . kind === ts . SyntaxKind . ThisKeyword ) ;
@@ -644,10 +604,6 @@ export class TSHelper {
644604 signatureDeclarations . map ( s => TSHelper . getDeclarationContextType ( s , checker ) ) ) ;
645605 }
646606
647- public static isDefaultArrayPropertyName ( methodName : string ) : boolean {
648- return defaultArrayPropertyNames . has ( methodName ) ;
649- }
650-
651607 public static escapeString ( text : string ) : string {
652608 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
653609 const escapeSequences : Array < [ RegExp , string ] > = [
0 commit comments