diff options
Diffstat (limited to 'lib/handlebars/compiler/ast.js')
-rw-r--r-- | lib/handlebars/compiler/ast.js | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index c193460..45212b3 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -8,21 +8,25 @@ var AST = { this.strip = strip; }, - MustacheStatement: function(sexpr, escaped, strip, locInfo) { + MustacheStatement: function(path, params, hash, escaped, strip, locInfo) { this.loc = locInfo; this.type = 'MustacheStatement'; - this.sexpr = sexpr; + this.path = path; + this.params = params || []; + this.hash = hash; this.escaped = escaped; this.strip = strip; }, - BlockStatement: function(sexpr, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) { + BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) { this.loc = locInfo; - this.type = 'BlockStatement'; - this.sexpr = sexpr; + + this.path = path; + this.params = params || []; + this.hash = hash; this.program = program; this.inverse = inverse; @@ -31,12 +35,15 @@ var AST = { this.closeStrip = closeStrip; }, - PartialStatement: function(sexpr, strip, locInfo) { + PartialStatement: function(name, params, hash, strip, locInfo) { this.loc = locInfo; this.type = 'PartialStatement'; - this.sexpr = sexpr; - this.indent = ''; + this.name = name; + this.params = params || []; + this.hash = hash; + + this.indent = ''; this.strip = strip; }, @@ -63,15 +70,6 @@ var AST = { this.hash = hash; }, - PartialExpression: function(name, params, hash, locInfo) { - this.loc = locInfo; - - this.type = 'PartialExpression'; - this.name = name; - this.params = params || []; - this.hash = hash; - }, - PathExpression: function(data, depth, parts, original, locInfo) { this.loc = locInfo; this.type = 'PathExpression'; @@ -121,8 +119,8 @@ var AST = { // * it is an eligible helper, and // * it has at least one parameter or hash segment // TODO: Make these public utility methods - helperExpression: function(sexpr) { - return !!(sexpr.isHelper || sexpr.params.length || sexpr.hash); + helperExpression: function(node) { + return !!(node.type === 'SubExpression' || node.params.length || node.hash); }, scopedId: function(path) { |