ts-simple-ast
Version:
TypeScript compiler wrapper for static analysis and code manipulation.
47 lines (46 loc) • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var utils_1 = require("../../../utils");
/**
* Referenced symbol.
*/
var ReferencedSymbol = /** @class */ (function () {
/**
* @private
*/
function ReferencedSymbol(context, compilerObject) {
this._context = context;
this._compilerObject = compilerObject;
// it's important to store the references so that the nodes referenced inside will point
// to the right node in case the user does manipulation between getting this object and getting the references
this._references = this.compilerObject.references.map(function (r) { return context.compilerFactory.getReferenceEntry(r); });
}
Object.defineProperty(ReferencedSymbol.prototype, "compilerObject", {
/**
* Gets the compiler referenced symbol.
*/
get: function () {
return this._compilerObject;
},
enumerable: true,
configurable: true
});
/**
* Gets the definition.
*/
ReferencedSymbol.prototype.getDefinition = function () {
return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition);
};
/**
* Gets the references.
*/
ReferencedSymbol.prototype.getReferences = function () {
return this._references;
};
tslib_1.__decorate([
utils_1.Memoize
], ReferencedSymbol.prototype, "getDefinition", null);
return ReferencedSymbol;
}());
exports.ReferencedSymbol = ReferencedSymbol;