summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2012-07-05 23:08:57 -0700
committerYehuda Katz <wycats@gmail.com>2012-07-05 23:08:57 -0700
commit659be5a6904cd21ecfc0a697057793ede1a33ca6 (patch)
tree1c200c031f55513e50967f40b2c53214e9b78abf /lib/handlebars/compiler/compiler.js
parent46c04fa71e1aa960c874a14b9596425aa04a2297 (diff)
downloadhandlebars.js-659be5a6904cd21ecfc0a697057793ede1a33ca6.zip
handlebars.js-659be5a6904cd21ecfc0a697057793ede1a33ca6.tar.gz
handlebars.js-659be5a6904cd21ecfc0a697057793ede1a33ca6.tar.bz2
Reduce duplication
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index c7d2dbb..0dea5bb 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -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');
},