@@ -125,30 +125,6 @@ function findFirstMatchingChild(node, sourceFile, predicate) {
125
125
return undefined ;
126
126
}
127
127
128
- /**
129
- * Returns true if the given TSNode is a let variable declaration
130
- * @param {TSNode } node The TSNode
131
- * @returns {boolean } whether or not the given node is a let variable declaration
132
- */
133
- function isLet ( node ) {
134
- /**
135
- * TODO: Remove dependency on private TypeScript method
136
- */
137
- return ts . isLet ( node ) ;
138
- }
139
-
140
- /**
141
- * Returns true if the given TSNode is a const variable declaration
142
- * @param {TSNode } node The TSNode
143
- * @returns {boolean } whether or not the given node is a const variable declaration
144
- */
145
- function isConst ( node ) {
146
- /**
147
- * TODO: Remove dependency on private TypeScript method
148
- */
149
- return ts . isConst ( node ) ;
150
- }
151
-
152
128
//------------------------------------------------------------------------------
153
129
// Public
154
130
//------------------------------------------------------------------------------
@@ -179,7 +155,6 @@ module.exports = {
179
155
findFirstMatchingAncestor,
180
156
findAncestorOfKind,
181
157
hasJSXAncestor,
182
- unescapeIdentifier,
183
158
unescapeStringLiteralText,
184
159
isComputedProperty,
185
160
isOptional,
@@ -366,24 +341,20 @@ function isTypeKeyword(kind) {
366
341
* @returns {string } declaration kind
367
342
*/
368
343
function getDeclarationKind ( node ) {
369
- let varDeclarationKind ;
370
344
switch ( node . kind ) {
371
345
case SyntaxKind . TypeAliasDeclaration :
372
- varDeclarationKind = "type" ;
373
- break ;
346
+ return "type" ;
374
347
case SyntaxKind . VariableDeclarationList :
375
- if ( isLet ( node ) ) {
376
- varDeclarationKind = "let" ;
377
- } else if ( isConst ( node ) ) {
378
- varDeclarationKind = "const" ;
379
- } else {
380
- varDeclarationKind = "var" ;
348
+ if ( node . flags & ts . NodeFlags . Let ) {
349
+ return "let" ;
381
350
}
382
- break ;
351
+ if ( node . flags & ts . NodeFlags . Const ) {
352
+ return "const" ;
353
+ }
354
+ return "var" ;
383
355
default :
384
356
throw "Unable to determine declaration kind." ;
385
357
}
386
- return varDeclarationKind ;
387
358
}
388
359
389
360
/**
@@ -502,15 +473,6 @@ function hasJSXAncestor(node) {
502
473
return ! ! findFirstMatchingAncestor ( node , isJSXToken ) ;
503
474
}
504
475
505
- /**
506
- * Remove extra underscore from escaped identifier text content.
507
- * @param {string } identifier The escaped identifier text.
508
- * @returns {string } The unescaped identifier text.
509
- */
510
- function unescapeIdentifier ( identifier ) {
511
- return ts . unescapeIdentifier ( identifier ) ;
512
- }
513
-
514
476
/**
515
477
* Unescape the text content of string literals, e.g. & -> &
516
478
* @param {string } text The escaped string literal text.
0 commit comments