Use += in printer
This commit is contained in:
@@ -15,10 +15,10 @@ PrintVisitor.prototype.pad = function(string) {
|
||||
let out = '';
|
||||
|
||||
for (let i = 0, l = this.padding; i < l; i++) {
|
||||
out = out + ' ';
|
||||
out += ' ';
|
||||
}
|
||||
|
||||
out = out + string + '\n';
|
||||
out += string + '\n';
|
||||
return out;
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ PrintVisitor.prototype.Program = function(program) {
|
||||
}
|
||||
|
||||
for (i = 0, l = body.length; i < l; i++) {
|
||||
out = out + this.accept(body[i]);
|
||||
out += this.accept(body[i]);
|
||||
}
|
||||
|
||||
this.padding--;
|
||||
@@ -52,20 +52,20 @@ PrintVisitor.prototype.MustacheStatement = function(mustache) {
|
||||
PrintVisitor.prototype.BlockStatement = function(block) {
|
||||
let out = '';
|
||||
|
||||
out = out + this.pad('BLOCK:');
|
||||
out += this.pad('BLOCK:');
|
||||
this.padding++;
|
||||
out = out + this.pad(this.SubExpression(block));
|
||||
out += this.pad(this.SubExpression(block));
|
||||
if (block.program) {
|
||||
out = out + this.pad('PROGRAM:');
|
||||
out += this.pad('PROGRAM:');
|
||||
this.padding++;
|
||||
out = out + this.accept(block.program);
|
||||
out += this.accept(block.program);
|
||||
this.padding--;
|
||||
}
|
||||
if (block.inverse) {
|
||||
if (block.program) { this.padding++; }
|
||||
out = out + this.pad('{{^}}');
|
||||
out += this.pad('{{^}}');
|
||||
this.padding++;
|
||||
out = out + this.accept(block.inverse);
|
||||
out += this.accept(block.inverse);
|
||||
this.padding--;
|
||||
if (block.program) { this.padding--; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user