Reduce duplication

This commit is contained in:
Yehuda Katz
2012-07-05 23:08:57 -07:00
parent 46c04fa71e
commit 659be5a690
+5 -9
View File
@@ -210,21 +210,17 @@ Handlebars.JavaScriptCompiler = function() {};
simpleMustache: function(mustache, program, inverse) {
var id = mustache.id;
if (id.type === 'ID') {
this.addDepth(id.depth);
this.opcode('getContext', id.depth);
}
if (id.type === 'DATA') {
this.DATA(id);
} else if (id.parts.length) {
this.opcode('lookupOnContext', id.parts[0]);
for(var i=1, l=id.parts.length; i<l; i++) {
this.opcode('lookup', id.parts[i]);
}
this.ID(id);
} else {
// Simplified ID for `this`
this.addDepth(id.depth);
this.opcode('getContext', id.depth);
this.opcode('pushContext');
}
this.opcode('resolvePossibleLambda');
},