UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

69 lines (68 loc) 2.81 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 __()); }; })(); var __values = (this && this.__values)/* istanbul ignore next */ || function (o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; }; Object.defineProperty(exports, "__esModule", { value: true }); var StructureToText_1 = require("./../StructureToText"); var JSDocStructureToText = /** @class */ (function (_super) { __extends(JSDocStructureToText, _super); function JSDocStructureToText() { return _super !== null && _super.apply(this, arguments) || this; } JSDocStructureToText.prototype.writeText = function (structure) { var lines = structure.description.split(/\r?\n/); this.writer.writeLine("/**"); try { for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) { var line = lines_1_1.value; this.writer.writeLine(" * " + line); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1); } finally { if (e_1) throw e_1.error; } } this.writer.writeLine(" */"); var e_1, _a; }; JSDocStructureToText.prototype.writeDocs = function (structures) { if (structures == null) return; try { for (var structures_1 = __values(structures), structures_1_1 = structures_1.next(); !structures_1_1.done; structures_1_1 = structures_1.next()) { var structure = structures_1_1.value; this.writeText(structure); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (structures_1_1 && !structures_1_1.done && (_a = structures_1.return)) _a.call(structures_1); } finally { if (e_2) throw e_2.error; } } var e_2, _a; }; return JSDocStructureToText; }(StructureToText_1.StructureToText)); exports.JSDocStructureToText = JSDocStructureToText;