diff --git a/bench/templates/paths.js b/bench/templates/paths.js index 0a426dd83..d84e06152 100644 --- a/bench/templates/paths.js +++ b/bench/templates/paths.js @@ -1,7 +1,7 @@ module.exports = { - context: { person: { name: "Larry", age: 45 } }, - handlebars: "{{person.name}}{{person.age}}{{person.foo}}{{animal.age}}", - dust: "{person.name}{person.age}{person.foo}{animal.age}", - eco: "<%= @person.name %><%= @person.age %><%= @person.foo %><% if @animal: %><%= @animal.age %><% end %>", - mustache: "{{person.name}}{{person.age}}{{person.foo}}{{animal.age}}" + context: { person: { name: {bar: {baz: "Larry"}}, age: 45 } }, + handlebars: "{{person.name.bar.baz}}{{person.age}}{{person.foo}}{{animal.age}}", + dust: "{person.name.bar.baz}{person.age}{person.foo}{animal.age}", + eco: "<%= @person.name.bar.baz %><%= @person.age %><%= @person.foo %><% if @animal: %><%= @animal.age %><% end %>", + mustache: "{{person.name.bar.baz}}{{person.age}}{{person.foo}}{{animal.age}}" }; diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index e5f2280ac..31176c9a3 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