@@ -372,9 +372,7 @@ Compiler.prototype = {
|
||||
},
|
||||
|
||||
pushParams: function(params) {
|
||||
var i = params.length;
|
||||
|
||||
while(i--) {
|
||||
for(var i=0, l=params.length; i<l; i++) {
|
||||
this.pushParam(params[i]);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -915,16 +915,19 @@ JavaScriptCompiler.prototype = {
|
||||
options.inverse = inverse;
|
||||
}
|
||||
|
||||
for (var i = 0; i < paramSize; i++) {
|
||||
// The parameters go on to the stack in order (making sure that they are evaluated in order)
|
||||
// so we need to pop them off the stack in reverse order
|
||||
var i = paramSize;
|
||||
while (i--) {
|
||||
param = this.popStack();
|
||||
params.push(param);
|
||||
params[i] = param;
|
||||
|
||||
if (this.trackIds) {
|
||||
ids.push(this.popStack());
|
||||
ids[i] = this.popStack();
|
||||
}
|
||||
if (this.stringParams) {
|
||||
types.push(this.popStack());
|
||||
contexts.push(this.popStack());
|
||||
types[i] = this.popStack();
|
||||
contexts[i] = this.popStack();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,22 @@ describe('subexpressions', function() {
|
||||
shouldCompileTo(string, [context, helpers], "val is true");
|
||||
});
|
||||
|
||||
it("mixed paths and helpers", function() {
|
||||
var string = '{{blog baz.bat (equal a b) baz.bar}}';
|
||||
|
||||
var context = { bar: "LOL", baz: {bat: 'foo!', bar: 'bar!'} };
|
||||
var helpers = {
|
||||
blog: function(val, that, theOther) {
|
||||
console.log(arguments);
|
||||
return "val is " + val + ', ' + that + ' and ' + theOther;
|
||||
},
|
||||
equal: function(x, y) {
|
||||
return x === y;
|
||||
}
|
||||
};
|
||||
shouldCompileTo(string, [context, helpers], "val is foo!, true and bar!");
|
||||
});
|
||||
|
||||
it("supports much nesting", function() {
|
||||
var string = '{{blog (equal (equal true true) true)}}';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user