Transform literals to path expressions in mustache nodes
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user