ts-simple-ast
Version:
TypeScript compiler wrapper for static analysis and code manipulation.
48 lines (47 loc) • 1.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var utils_1 = require("../../../utils");
var FileTextChanges_1 = require("./FileTextChanges");
/**
* Set of edits to make in response to a refactor action, plus an optional location where renaming should be invoked from.
*/
var RefactorEditInfo = /** @class */ (function () {
/** @private */
function RefactorEditInfo(context, compilerObject) {
this._context = context;
this._compilerObject = compilerObject;
}
Object.defineProperty(RefactorEditInfo.prototype, "compilerObject", {
/** Gets the compiler refactor edit info. */
get: function () {
return this._compilerObject;
},
enumerable: true,
configurable: true
});
/**
* Gets refactor file text changes
*/
RefactorEditInfo.prototype.getEdits = function () {
var _this = this;
return this.compilerObject.edits.map(function (edit) { return new FileTextChanges_1.FileTextChanges(_this._context, edit); });
};
/**
* Gets the file path for a rename refactor.
*/
RefactorEditInfo.prototype.getRenameFilePath = function () {
return this.compilerObject.renameFilename;
};
/**
* Location where renaming should be invoked from.
*/
RefactorEditInfo.prototype.getRenameLocation = function () {
return this.compilerObject.renameLocation;
};
tslib_1.__decorate([
utils_1.Memoize
], RefactorEditInfo.prototype, "getEdits", null);
return RefactorEditInfo;
}());
exports.RefactorEditInfo = RefactorEditInfo;