* @desc Parses the abstract syntax tree for *Variable Declaration* * @param {Object} varDecNode - An ast Node * @param {Array} retArr - return array string * @returns {Array} the append retArr
(varDecNode, retArr)
| 320 | * @returns {Array} the append retArr |
| 321 | */ |
| 322 | astVariableDeclaration(varDecNode, retArr) { |
| 323 | retArr.push(`${varDecNode.kind} `); |
| 324 | const { declarations } = varDecNode; |
| 325 | for (let i = 0; i < declarations.length; i++) { |
| 326 | if (i > 0) { |
| 327 | retArr.push(','); |
| 328 | } |
| 329 | const declaration = declarations[i]; |
| 330 | const info = this.getDeclaration(declaration.id); |
| 331 | if (!info.valueType) { |
| 332 | info.valueType = this.getType(declaration.init); |
| 333 | } |
| 334 | this.astGeneric(declaration, retArr); |
| 335 | } |
| 336 | if (!this.isState('in-for-loop-init')) { |
| 337 | retArr.push(';'); |
| 338 | } |
| 339 | return retArr; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * @desc Parses the abstract syntax tree for *If* Statement |
no test coverage detected