summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-07-30 10:56:58 -0500
committerkpdecker <kpdecker@gmail.com>2013-10-14 22:50:50 -0500
commit151e6d49c05dd93305a6ee1cad57154a01396ea0 (patch)
treea824932fc78b94f8c6daddbef71a7d68adf3898f /lib/handlebars/compiler/compiler.js
parent4e4920cc78b1ad68ca325d9677b2fb8f3dfbaa3a (diff)
downloadhandlebars.js-151e6d49c05dd93305a6ee1cad57154a01396ea0.zip
handlebars.js-151e6d49c05dd93305a6ee1cad57154a01396ea0.tar.gz
handlebars.js-151e6d49c05dd93305a6ee1cad57154a01396ea0.tar.bz2
Wrap AST nodes in strip opcodes if defined
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 5b782c4..4f232eb 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -98,11 +98,23 @@ Compiler.prototype = {
},
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;
+ var statements = program.statements;
for(var i=0, l=statements.length; i<l; i++) {
this.accept(statements[i]);