all files / dist/writers/ DecoratorWriter.js

100% Statements 23/23
100% Branches 4/4
100% Functions 6/6
100% Lines 23/23
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  15× 15×                  
"use strict";
var WriteFlags_1 = require("./../WriteFlags");
var DecoratorWriter = (function () {
    function DecoratorWriter(writer, baseDefinitionWriter) {
        this.writer = writer;
        this.baseDefinitionWriter = baseDefinitionWriter;
    }
    DecoratorWriter.prototype.write = function (def, flags) {
        var _this = this;
        if (flags & WriteFlags_1.WriteFlags.HideFunctionImplementations)
            return;
        this.baseDefinitionWriter.writeWrap(def, function () {
            _this.writer.write("@");
            _this.writer.write(def.name);
            if (def.isDecoratorFactory)
                _this.writeArgs(def);
        });
    };
    DecoratorWriter.prototype.writeArgs = function (def) {
        var _this = this;
        this.writer.write("(");
        def.arguments.forEach(function (arg, i) {
            _this.writer.conditionalWrite(i !== 0, ", ");
            _this.writer.write(arg.text);
        });
        this.writer.write(")");
    };
    return DecoratorWriter;
}());
exports.DecoratorWriter = DecoratorWriter;
 
//# sourceMappingURL=DecoratorWriter.js.map