@@ -116,44 +116,44 @@ TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@";
116
116
TOKEN_TO_TEXT [ SyntaxKind . InKeyword ] = "in" ;
117
117
118
118
/**
119
- * Returns true if the given node is a valid ESTree class member
120
- * @param {object } node AST node
121
- * @returns {boolean } is valid class member
119
+ * Returns true if the given TSNode is a valid ESTree class member
120
+ * @param {TSNode } node TypeScript AST node
121
+ * @returns {boolean } is valid ESTree class member
122
122
*/
123
123
function isESTreeClassMember ( node ) {
124
124
return node . kind !== SyntaxKind . PropertyDeclaration && node . kind !== SyntaxKind . SemicolonClassElement ;
125
125
}
126
126
127
127
/**
128
- * Returns true if the given token is a comma
129
- * @param {object } token the syntax token
128
+ * Returns true if the given TSToken is a comma
129
+ * @param {TSToken } token the TypeScript token
130
130
* @returns {boolean } is comma
131
131
*/
132
132
function isComma ( token ) {
133
133
return token . kind === SyntaxKind . CommaToken ;
134
134
}
135
135
136
136
/**
137
- * Returns true if the given operator is the assignment operator
138
- * @param {object } operator the operator
137
+ * Returns true if the given TSToken is the assignment operator
138
+ * @param {TSToken } operator the operator token
139
139
* @returns {boolean } is assignment
140
140
*/
141
141
function isAssignmentOperator ( operator ) {
142
142
return ASSIGNMENT_OPERATORS . indexOf ( operator . kind ) > - 1 ;
143
143
}
144
144
145
145
/**
146
- * Returns true if the given operator is a logical operator
147
- * @param {object } operator the operator
146
+ * Returns true if the given TSToken is a logical operator
147
+ * @param {TSToken } operator the operator token
148
148
* @returns {boolean } is a logical operator
149
149
*/
150
150
function isLogicalOperator ( operator ) {
151
151
return LOGICAL_OPERATORS . indexOf ( operator . kind ) > - 1 ;
152
152
}
153
153
154
154
/**
155
- * Returns the binary expression type of the given operator
156
- * @param {object } operator the operator
155
+ * Returns the binary expression type of the given TSToken
156
+ * @param {TSToken } operator the operator token
157
157
* @returns {string } the binary expression type
158
158
*/
159
159
function getBinaryExpressionType ( operator ) {
@@ -169,10 +169,10 @@ function getBinaryExpressionType(operator) {
169
169
/**
170
170
* Returns line and column data for the given start and end positions,
171
171
* for the given AST
172
- * @param {object } start start data
173
- * @param {object } end end data
174
- * @param {object } ast the AST object
175
- * @returns {object } the loc data
172
+ * @param {Object } start start data
173
+ * @param {Object } end end data
174
+ * @param {Object } ast the AST object
175
+ * @returns {Object } the loc data
176
176
*/
177
177
function getLocFor ( start , end , ast ) {
178
178
var startLoc = ast . getLineAndCharacterOfPosition ( start ) ,
@@ -191,11 +191,11 @@ function getLocFor(start, end, ast) {
191
191
}
192
192
193
193
/**
194
- * Returns line and column data for the given node or token ,
194
+ * Returns line and column data for the given ESTreeNode or ESTreeToken ,
195
195
* for the given AST
196
- * @param {object } nodeOrToken the node or token
197
- * @param {object } ast the AST object
198
- * @returns {object } the loc data
196
+ * @param {ESTreeToken|ESTreeNode } nodeOrToken the ESTreeNode or ESTreeToken
197
+ * @param {Object } ast the AST object
198
+ * @returns {Object } the loc data
199
199
*/
200
200
function getLoc ( nodeOrToken , ast ) {
201
201
return getLocFor ( nodeOrToken . getStart ( ) , nodeOrToken . end , ast ) ;
@@ -216,11 +216,11 @@ function getLoc(nodeOrToken, ast) {
216
216
}
217
217
218
218
/**
219
- * Fixes the exports of the given node
220
- * @param {object } node the node
221
- * @param {object } result result
222
- * @param {[type] } ast the AST
223
- * @returns {object } the node with fixed exports
219
+ * Fixes the exports of the given TSNode
220
+ * @param {TSNode } node the TSNode
221
+ * @param {Object } result result
222
+ * @param {Object } ast the AST
223
+ * @returns {TSNode } the TSNode with fixed exports
224
224
*/
225
225
function fixExports ( node , result , ast ) {
226
226
// check for exports
@@ -255,8 +255,8 @@ function fixExports(node, result, ast) {
255
255
256
256
/**
257
257
* Extends and formats a given error object
258
- * @param {object } error the error object
259
- * @returns {object } converted error object
258
+ * @param {Object } error the error object
259
+ * @returns {Object } converted error object
260
260
*/
261
261
function convertError ( error ) {
262
262
@@ -271,8 +271,8 @@ function convertError(error) {
271
271
}
272
272
273
273
/**
274
- * Returns the type of a given token
275
- * @param {object } token the token
274
+ * Returns the type of a given ESTreeToken
275
+ * @param {ESTreeToken } token the ESTreeToken
276
276
* @returns {string } the token type
277
277
*/
278
278
function getTokenType ( token ) {
@@ -327,10 +327,10 @@ function getTokenType(token) {
327
327
}
328
328
329
329
/**
330
- * Extends and formats a given token , for a given AST
331
- * @param {object } token the token
332
- * @param {object } ast the AST object
333
- * @returns {object } the converted token
330
+ * Extends and formats a given ESTreeToken , for a given AST
331
+ * @param {ESTreeToken } token the ESTreeToken
332
+ * @param {Object } ast the AST object
333
+ * @returns {ESTreeToken } the converted ESTreeToken
334
334
*/
335
335
function convertToken ( token , ast ) {
336
336
@@ -355,8 +355,8 @@ function convertToken(token, ast) {
355
355
356
356
/**
357
357
* Converts all tokens for the given AST
358
- * @param {object } ast the AST object
359
- * @returns {array } the converted tokens
358
+ * @param {Object } ast the AST object
359
+ * @returns {ESTreeToken[] } the converted ESTreeTokens
360
360
*/
361
361
function convertTokens ( ast ) {
362
362
var token = ast . getFirstToken ( ) ,
@@ -386,10 +386,10 @@ module.exports = function(ast, extra) {
386
386
}
387
387
388
388
/**
389
- * Converts node
390
- * @param {object } node the node
391
- * @param {object } parent the parent node
392
- * @returns {object } the converted node
389
+ * Converts a TypeScript node into an ESTree node
390
+ * @param {TSNode } node the TSNode
391
+ * @param {TSNode } parent the parent TSNode
392
+ * @returns {ESTreeNode } the converted ESTreeNode
393
393
*/
394
394
function convert ( node , parent ) {
395
395
@@ -405,7 +405,8 @@ module.exports = function(ast, extra) {
405
405
} ;
406
406
407
407
/**
408
- * Copies the result object
408
+ * Copies the result object into an ESTree node with just a type property.
409
+ * This is used only for leaf nodes that have no other properties.
409
410
* @returns {void }
410
411
*/
411
412
function simplyCopy ( ) {
@@ -415,9 +416,9 @@ module.exports = function(ast, extra) {
415
416
}
416
417
417
418
/**
418
- * Converts child node
419
- * @param {object } child the child node
420
- * @returns {object } the converted child node
419
+ * Converts a TypeScript node into an ESTree node.
420
+ * @param {TSNode } child the child TSNode
421
+ * @returns {ESTreeNode } the converted ESTree node
421
422
*/
422
423
function convertChild ( child ) {
423
424
return convert ( child , node ) ;
0 commit comments