UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

71 lines (69 loc) 2.03 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("./../../../utils"); const TextSpan_1 = require("./TextSpan"); /** * Definition info. */ class DefinitionInfo { /** * @internal */ constructor(global, compilerObject) { this.global = global; this._compilerObject = compilerObject; } /** * Gets the compiler object. */ get compilerObject() { return this._compilerObject; } /** * Gets the source file this reference is in. */ getSourceFile() { return this.global.compilerFactory.getSourceFileFromFilePath(this.compilerObject.fileName); } /** * Gets the text span. */ getTextSpan() { return new TextSpan_1.TextSpan(this.compilerObject.textSpan); } /** * Gets the kind. */ getKind() { return this.compilerObject.kind; } /** * Gets the name. */ getName() { return this.compilerObject.name; } /** * Gets the container kind. */ getContainerKind() { return this.compilerObject.containerKind; } /** * Gets the container name. */ getContainerName() { return this.compilerObject.containerName; } } __decorate([ utils_1.Memoize ], DefinitionInfo.prototype, "getTextSpan", null); exports.DefinitionInfo = DefinitionInfo; //# sourceMappingURL=DefinitionInfo.js.map