UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for static analysis and code manipulation.

27 lines (26 loc) 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var utils_1 = require("../../utils"); var FactoryStructurePrinter_1 = require("../FactoryStructurePrinter"); var TypedNodeStructurePrinter = /** @class */ (function (_super) { tslib_1.__extends(TypedNodeStructurePrinter, _super); function TypedNodeStructurePrinter(factory, separator, alwaysWrite) { if (alwaysWrite === void 0) { alwaysWrite = false; } var _this = _super.call(this, factory) || this; _this.separator = separator; _this.alwaysWrite = alwaysWrite; return _this; } TypedNodeStructurePrinter.prototype.printText = function (writer, structure) { var type = structure.type; if (type == null && this.alwaysWrite === false) return; type = type || "any"; var typeText = this.getTextWithQueuedChildIndentation(writer, type); if (!utils_1.StringUtils.isNullOrWhitespace(typeText)) writer.write(this.separator + " " + typeText); }; return TypedNodeStructurePrinter; }(FactoryStructurePrinter_1.FactoryStructurePrinter)); exports.TypedNodeStructurePrinter = TypedNodeStructurePrinter;