diff options
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 50195e3..4f232eb 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -72,6 +72,7 @@ Compiler.prototype = { guid: 0, compile: function(program, options) { + this.opcodes = []; this.children = []; this.depths = {list: []}; this.options = options; @@ -93,20 +94,30 @@ Compiler.prototype = { } } - return this.program(program); + return this.accept(program); }, accept: function(node) { - return this[node.type](node); + var strip = node.strip || {}, + ret; + if (strip.left) { + this.opcode('strip'); + } + + ret = this[node.type](node); + + if (strip.right) { + this.opcode('strip'); + } + + return ret; }, program: function(program) { - var statements = program.statements, statement; - this.opcodes = []; + var statements = program.statements; for(var i=0, l=statements.length; i<l; i++) { - statement = statements[i]; - this[statement.type](statement); + this.accept(statements[i]); } this.isSimple = l === 1; |