Generate Spacebars.call instead of calling the function manually

This commit is contained in:
Slava Kim
2015-01-26 13:46:54 -08:00
parent d7ca9fc000
commit 4df9b115a5
2 changed files with 4 additions and 4 deletions

View File

@@ -101,7 +101,7 @@ Blaze.Each = function (argFunc, contentFunc, elseFunc) {
var arg = argFunc();
if (_.isObject(arg) && _.has(arg, '_sequence')) {
eachView.variableName = arg._variable || null;
arg = arg._sequence();
arg = arg._sequence;
}
eachView.argVar.set(arg);
@@ -118,7 +118,7 @@ Blaze.Each = function (argFunc, contentFunc, elseFunc) {
if (! _.isObject(item)) {
item = {};
} else {
item = _.copy(item);
item = _.clone(item);
}
item[eachView.variableName] = _item;

View File

@@ -107,9 +107,9 @@ _.extend(CodeGen.prototype, {
}
// split out the variable name and sequence arguments
variable = args[0][1][0];// XXX take name as a string ignoring tag
dataCode = 'function () { return { _sequence: ' +
dataCode = 'function () { return { _sequence: Spacebars.call(' +
self.codeGenPath(args[2][1]) +
', _variable: "' + variable + '" }; }';
'), _variable: "' + variable + '" }; }';
}
}