ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
99 lines (98 loc) • 4.24 kB
JavaScript
;
var __extends = (this && this.__extends)/* istanbul ignore next */ || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("./../base");
var namespace_1 = require("./../namespace");
var callBaseFill_1 = require("./../callBaseFill");
var Statement_1 = require("./Statement");
exports.VariableStatementBase = base_1.ChildOrderableNode(namespace_1.NamespaceChildableNode(base_1.JSDocableNode(base_1.AmbientableNode(base_1.ExportableNode(base_1.ModifierableNode(Statement_1.Statement))))));
var VariableStatement = /** @class */ (function (_super) {
__extends(VariableStatement, _super);
function VariableStatement() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Get variable declaration list.
*/
VariableStatement.prototype.getDeclarationList = function () {
return this.getNodeFromCompilerNode(this.compilerNode.declarationList);
};
/**
* Get the variable declarations.
*/
VariableStatement.prototype.getDeclarations = function () {
return this.getDeclarationList().getDeclarations();
};
/**
* Gets the variable declaration type.
*/
VariableStatement.prototype.getDeclarationType = function () {
return this.getDeclarationList().getDeclarationType();
};
/**
* Gets the variable declaration type keyword.
*/
VariableStatement.prototype.getDeclarationTypeKeyword = function () {
return this.getDeclarationList().getDeclarationTypeKeyword();
};
/**
* Sets the variable declaration type.
* @param type - Type to set.
*/
VariableStatement.prototype.setDeclarationType = function (type) {
return this.getDeclarationList().setDeclarationType(type);
};
/**
* Add a variable declaration to the statement.
* @param structure - Structure representing the variable declaration to add.
*/
VariableStatement.prototype.addDeclaration = function (structure) {
return this.getDeclarationList().addDeclaration(structure);
};
/**
* Adds variable declarations to the statement.
* @param structures - Structures representing the variable declarations to add.
*/
VariableStatement.prototype.addDeclarations = function (structures) {
return this.getDeclarationList().addDeclarations(structures);
};
/**
* Inserts a variable declaration at the specified index within the statement.
* @param index - Index to insert.
* @param structure - Structure representing the variable declaration to insert.
*/
VariableStatement.prototype.insertDeclaration = function (index, structure) {
return this.getDeclarationList().insertDeclaration(index, structure);
};
/**
* Inserts variable declarations at the specified index within the statement.
* @param index - Index to insert.
* @param structures - Structures representing the variable declarations to insert.
*/
VariableStatement.prototype.insertDeclarations = function (index, structures) {
return this.getDeclarationList().insertDeclarations(index, structures);
};
/**
* Fills the node from a structure.
* @param structure - Structure to fill.
*/
VariableStatement.prototype.fill = function (structure) {
callBaseFill_1.callBaseFill(exports.VariableStatementBase.prototype, this, structure);
if (structure.declarationType != null)
this.setDeclarationType(structure.declarationType);
if (structure.declarations != null)
this.addDeclarations(structure.declarations);
return this;
};
return VariableStatement;
}(exports.VariableStatementBase));
exports.VariableStatement = VariableStatement;