UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

24 lines (22 loc) 755 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const errors = require("./../../../errors"); function NamedNode(Base) { return class extends Base { getNameIdentifier() { return this.global.compilerFactory.getNodeFromCompilerNode(this.compilerNode.name, this.sourceFile); } getName() { return this.getNameIdentifier().getText(); } rename(newName) { if (newName === this.getName()) return this; errors.throwIfNotStringOrWhitespace(newName, "newName"); this.getNameIdentifier().rename(newName); return this; } }; } exports.NamedNode = NamedNode; //# sourceMappingURL=NamedNode.js.map