Alias self -> this
This commit is contained in:
@@ -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(", ") + ")";
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user