ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
50 lines (48 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Node_1 = require("./Node");
class Identifier extends Node_1.Node {
/**
* Gets the text for the identifier.
*/
getText() {
return this.compilerNode.text;
}
/**
* Renames the identifier.
* @param newName - New name of the identifier.
*/
rename(newName) {
this.global.languageService.renameNode(this, newName);
}
/**
* Finds all the references of this identifier.
*/
findReferences() {
return this.global.languageService.findReferences(this);
}
/**
* Gets the definitions of the current identifier.
*
* This is similar to "go to definition."
*/
getDefinitions() {
return this.global.languageService.getDefinitions(this);
}
/**
* Gets the implementations of the current identifier.
*
* This is similar to "go to implementation."
*/
getImplementations() {
return this.global.languageService.getImplementations(this);
}
/**
* Gets the type of the identifier.
*/
getType() {
return this.global.typeChecker.getTypeAtLocation(this);
}
}
exports.Identifier = Identifier;
//# sourceMappingURL=Identifier.js.map