UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

68 lines (66 loc) 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Diagnostic. */ class Diagnostic { /** @internal */ constructor(global, compilerObject) { this.global = global; this._compilerObject = compilerObject; } /** * Gets the underlying compiler diagnostic. */ get compilerObject() { return this._compilerObject; } /** * Gets the source file. */ getSourceFile() { const file = this.compilerObject.file; return file == null ? undefined : this.global.compilerFactory.getSourceFile(file); } /** * Gets the message text. */ getMessageText() { const messageText = this._compilerObject.messageText; if (typeof messageText === "string") return messageText; return this.global.compilerFactory.getDiagnosticMessageChain(messageText); } /** * Gets the start. */ getStart() { return this.compilerObject.start; } /** * Gets the length. */ getLength() { return this.compilerObject.length; } /** * Gets the diagnostic category. */ getCategory() { return this.compilerObject.category; } /** * Gets the code of the diagnostic. */ getCode() { return this.compilerObject.code; } /** * Gets the source. */ getSource() { return this.compilerObject.source; } } exports.Diagnostic = Diagnostic; //# sourceMappingURL=Diagnostic.js.map