diff options
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 75b2c1b..605a54b 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -172,11 +172,8 @@ Compiler.prototype = { }, MustacheStatement: function(mustache) { - if (!mustache.path.type.match(/Literal$/)) { - this.SubExpression(mustache); - } else { - this.accept(mustache.path); - } + transformLiteralToPath(mustache); + this.SubExpression(mustache); if(mustache.escaped && !this.options.noEscape) { this.opcode('appendEscaped'); @@ -489,3 +486,10 @@ function argEquals(a, b) { return true; } } + +function transformLiteralToPath(mustache) { + if (mustache.path.type.match(/Literal$/)) { + var literal = mustache.path; + mustache.path = { type: 'PathExpression', original: String(literal.original), parts: [String(literal.original)], depth: 0, data: false }; + } +} |