summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/compiler')
-rw-r--r--lib/handlebars/compiler/ast.js3
-rw-r--r--lib/handlebars/compiler/helpers.js4
-rw-r--r--lib/handlebars/compiler/printer.js9
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js
index 35a60db..0bc70e9 100644
--- a/lib/handlebars/compiler/ast.js
+++ b/lib/handlebars/compiler/ast.js
@@ -9,10 +9,11 @@ function LocationInfo(locInfo) {
}
var AST = {
- ProgramNode: function(statements, strip, locInfo) {
+ ProgramNode: function(statements, blockParams, strip, locInfo) {
LocationInfo.call(this, locInfo);
this.type = "program";
this.statements = statements;
+ this.blockParams = blockParams;
this.strip = strip;
},
diff --git a/lib/handlebars/compiler/helpers.js b/lib/handlebars/compiler/helpers.js
index d9b7b14..50a3c53 100644
--- a/lib/handlebars/compiler/helpers.js
+++ b/lib/handlebars/compiler/helpers.js
@@ -23,7 +23,7 @@ export function prepareRawBlock(openRawBlock, content, close, locInfo) {
throw new Exception(openRawBlock.sexpr.id.original + " doesn't match " + close, errorNode);
}
- var program = new this.ProgramNode([content], {}, locInfo);
+ var program = new this.ProgramNode([content], null, {}, locInfo);
return new this.BlockNode(openRawBlock.sexpr, program, undefined, undefined, locInfo);
}
@@ -40,6 +40,8 @@ export function prepareBlock(openBlock, program, inverseAndProgram, close, inver
throw new Exception(openBlock.sexpr.id.original + ' doesn\'t match ' + close.path.original, errorNode);
}
+ program.blockParams = openBlock.blockParams;
+
// Safely handle a chained inverse that does not have a non-conditional inverse
// (i.e. both inverseAndProgram AND close are undefined)
if (!close) {
diff --git a/lib/handlebars/compiler/printer.js b/lib/handlebars/compiler/printer.js
index c329373..e93652c 100644
--- a/lib/handlebars/compiler/printer.js
+++ b/lib/handlebars/compiler/printer.js
@@ -26,6 +26,15 @@ PrintVisitor.prototype.program = function(program) {
statements = program.statements,
i, l;
+ if (program.blockParams) {
+ var blockParams = "BLOCK PARAMS: [";
+ for(i=0, l=program.blockParams.length; i<l; i++) {
+ blockParams += " " + program.blockParams[i];
+ }
+ blockParams += " ]";
+ out += this.pad(blockParams);
+ }
+
for(i=0, l=statements.length; i<l; i++) {
out = out + this.accept(statements[i]);
}