Alias self -> this

This commit is contained in:
kpdecker
2011-07-31 14:58:37 -05:00
parent 9821da8df7
commit 77a20a3a9f
+4 -3
View File
@@ -321,6 +321,7 @@ Handlebars.JavaScriptCompiler = function() {};
this.context = {
aliases: {},
aliases: { self: 'this' },
registers: {list: []}
};
@@ -611,9 +612,9 @@ Handlebars.JavaScriptCompiler = function() {};
},
programExpression: function(guid) {
if(guid == null) { return "this.noop"; }
var programParams = [guid, "helpers", "partials"];
if(guid == null) { return "self.noop"; }
var depths = this.environment.rawChildren[guid].depths.list;
@@ -635,10 +636,10 @@ Handlebars.JavaScriptCompiler = function() {};
}
if(depths.length === 0) {
return "this.program(" + programParams.join(", ") + ")";
return "self.program(" + programParams.join(", ") + ")";
} else {
programParams[0] = "this.children[" + guid + "]";
return "this.programWithDepth(" + programParams.join(", ") + ")";
return "self.programWithDepth(" + programParams.join(", ") + ")";
}
},