UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

57 lines (56 loc) 2.05 kB
"use strict"; 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 PrimaryExpression_1 = require("./../expression/PrimaryExpression"); var Identifier = /** @class */ (function (_super) { __extends(Identifier, _super); function Identifier() { return _super !== null && _super.apply(this, arguments) || this; } /** * Gets the text for the identifier. */ Identifier.prototype.getText = function () { return this.compilerNode.text; }; /** * Renames the identifier. * @param newName - New name of the identifier. */ Identifier.prototype.rename = function (newName) { this.global.languageService.renameNode(this, newName); }; /** * Finds all the references of this identifier. */ Identifier.prototype.findReferences = function () { return this.global.languageService.findReferences(this); }; /** * Gets the definitions of the current identifier. * * This is similar to "go to definition." */ Identifier.prototype.getDefinitions = function () { return this.global.languageService.getDefinitions(this); }; /** * Gets the implementations of the current identifier. * * This is similar to "go to implementation." */ Identifier.prototype.getImplementations = function () { return this.global.languageService.getImplementations(this); }; return Identifier; }(PrimaryExpression_1.PrimaryExpression)); exports.Identifier = Identifier;