diff options
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index e5f2280..31176c9 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -275,6 +275,8 @@ Compiler.prototype = { } else if (this.options.knownHelpersOnly) { throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr); } else { + id.falsy = true; + this.ID(id); this.opcode('invokeHelper', params.length, id.original, sexpr.isRoot); } @@ -298,23 +300,16 @@ Compiler.prototype = { var name = id.parts[0]; if (!name) { + // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` this.opcode('pushContext'); } else { - this.opcode('lookupOnContext', id.parts[0]); - } - - for(var i=1, l=id.parts.length; i<l; i++) { - this.opcode('lookup', id.parts[i]); + this.opcode('lookupOnContext', id.parts, id.falsy); } }, DATA: function(data) { this.options.data = true; - this.opcode('lookupData', data.id.depth); - var parts = data.id.parts; - for(var i=0, l=parts.length; i<l; i++) { - this.opcode('lookup', parts[i]); - } + this.opcode('lookupData', data.id.depth, data.id.parts); }, STRING: function(string) { |