UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

29 lines (27 loc) 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ts = require("typescript"); const common_1 = require("./../common"); const VariableDeclarationType_1 = require("./VariableDeclarationType"); class VariableDeclarationList extends common_1.Node { /** * Get the variable declarations. */ getDeclarations() { return this.compilerNode.declarations.map(d => this.global.compilerFactory.getNodeFromCompilerNode(d, this.sourceFile)); } /** * Gets the variable declaration type. */ getDeclarationType() { const nodeFlags = this.compilerNode.flags; if (nodeFlags & ts.NodeFlags.Let) return VariableDeclarationType_1.VariableDeclarationType.Let; else if (nodeFlags & ts.NodeFlags.Const) return VariableDeclarationType_1.VariableDeclarationType.Const; else return VariableDeclarationType_1.VariableDeclarationType.Var; } } exports.VariableDeclarationList = VariableDeclarationList; //# sourceMappingURL=VariableDeclarationList.js.map