diff options
author | kpdecker <kpdecker@gmail.com> | 2014-11-26 12:46:38 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-11-26 19:04:18 -0600 |
commit | 2a4819d75cba7513946af5cf28ee22881561814f (patch) | |
tree | 6f88ee441e493e1d1f928598112a158400d500c8 /lib/handlebars/compiler/ast.js | |
parent | 5cfe6a0be16a912a5f00af251753a3d5746a6577 (diff) | |
download | handlebars.js-2a4819d75cba7513946af5cf28ee22881561814f.zip handlebars.js-2a4819d75cba7513946af5cf28ee22881561814f.tar.gz handlebars.js-2a4819d75cba7513946af5cf28ee22881561814f.tar.bz2 |
Update statement node ASTs
Diffstat (limited to 'lib/handlebars/compiler/ast.js')
-rw-r--r-- | lib/handlebars/compiler/ast.js | 81 |
1 files changed, 35 insertions, 46 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index 2f95cfb..26ea4ab 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -28,6 +28,41 @@ var AST = { this.strip = strip; }, + BlockNode: function(sexpr, program, inverse, strip, locInfo) { + this.loc = locInfo; + + this.type = 'BlockStatement'; + this.sexpr = sexpr; + this.program = program; + this.inverse = inverse; + this.strip = strip; + }, + + PartialNode: function(sexpr, strip, locInfo) { + this.loc = locInfo; + this.type = 'PartialStatement'; + this.sexpr = sexpr; + this.indent = ''; + + this.strip = strip; + this.strip.inlineStandalone = true; + }, + + ContentNode: function(string, locInfo) { + this.loc = locInfo; + this.type = 'ContentStatement'; + this.original = this.value = string; + }, + + CommentNode: function(comment, strip, locInfo) { + this.loc = locInfo; + this.type = 'CommentStatement'; + this.value = comment; + + this.strip = strip; + strip.inlineStandalone = true; + }, + SexprNode: function(rawParams, hash, locInfo) { this.loc = locInfo; @@ -51,37 +86,6 @@ var AST = { // pass or at runtime. }, - PartialNode: function(partialName, context, hash, strip, locInfo) { - this.loc = locInfo; - this.type = "partial"; - this.partialName = partialName; - this.context = context; - this.hash = hash; - this.strip = strip; - - this.strip.inlineStandalone = true; - }, - - BlockNode: function(sexpr, program, inverse, strip, locInfo) { - this.loc = locInfo; - - this.type = 'block'; - this.sexpr = sexpr; - this.program = program; - this.inverse = inverse; - this.strip = strip; - - if (inverse && !program) { - this.isInverse = true; - } - }, - - ContentNode: function(string, locInfo) { - this.loc = locInfo; - this.type = "content"; - this.original = this.string = string; - }, - HashNode: function(pairs, locInfo) { this.loc = locInfo; this.type = "hash"; @@ -128,12 +132,6 @@ var AST = { this.stringModeValue = this.string; }, - PartialNameNode: function(name, locInfo) { - this.loc = locInfo; - this.type = "PARTIAL_NAME"; - this.name = name.original; - }, - DataNode: function(id, locInfo) { this.loc = locInfo; this.type = "DATA"; @@ -163,15 +161,6 @@ var AST = { this.type = "BOOLEAN"; this.bool = bool; this.stringModeValue = bool === "true"; - }, - - CommentNode: function(comment, strip, locInfo) { - this.loc = locInfo; - this.type = "comment"; - this.comment = comment; - - this.strip = strip; - strip.inlineStandalone = true; } }; |