all files / dist/writers/ ClassConstructorWriter.js

100% Statements 27/27
100% Branches 3/3
100% Functions 7/7
100% Lines 27/27
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38  15× 15× 15× 15× 15× 15×                    
"use strict";
var WriteFlags_1 = require("./../WriteFlags");
var ClassConstructorWriter = (function () {
    function ClassConstructorWriter(writer, baseDefinitionWriter, documentationedWriter, parametersWriter, functionBodyWriter, scopeWriter) {
        this.writer = writer;
        this.baseDefinitionWriter = baseDefinitionWriter;
        this.documentationedWriter = documentationedWriter;
        this.parametersWriter = parametersWriter;
        this.functionBodyWriter = functionBodyWriter;
        this.scopeWriter = scopeWriter;
    }
    ClassConstructorWriter.prototype.shouldWriteConstructor = function (def, flags) {
        return (def.parameters.length > 0 || this.functionBodyWriter.willWriteFunctionBody(def, flags) || (flags & WriteFlags_1.WriteFlags.HideFunctionBodies) !== 0);
    };
    ClassConstructorWriter.prototype.write = function (def, flags) {
        var _this = this;
        this.baseDefinitionWriter.writeWrap(def, function () {
            def.overloadSignatures.forEach(function (signatureDef) {
                _this.writeStartOfConstructor(def);
                _this.parametersWriter.write(signatureDef, flags);
                _this.writer.write(";").newLine();
            });
            _this.writeStartOfConstructor(def);
            _this.parametersWriter.write(def, flags);
            _this.functionBodyWriter.write(def, flags);
        });
    };
    ClassConstructorWriter.prototype.writeStartOfConstructor = function (def) {
        this.documentationedWriter.write(def);
        this.scopeWriter.writeScope(def.scope);
        this.writer.write("constructor");
    };
    return ClassConstructorWriter;
}());
exports.ClassConstructorWriter = ClassConstructorWriter;
 
//# sourceMappingURL=ClassConstructorWriter.js.map