summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/ast.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2015-08-18 23:57:27 -0700
committerkpdecker <kpdecker@gmail.com>2015-08-18 23:57:27 -0700
commit95d84badcae89aa72a6f1433b851304700320920 (patch)
tree78dfd5cad87cb77d4353484781ff580bcbf2ad1c /lib/handlebars/compiler/ast.js
parent9a2d1d6009406915d1ca177ed5321e4727b9776f (diff)
downloadhandlebars.js-95d84badcae89aa72a6f1433b851304700320920.zip
handlebars.js-95d84badcae89aa72a6f1433b851304700320920.tar.gz
handlebars.js-95d84badcae89aa72a6f1433b851304700320920.tar.bz2
Drop AST constructors in favor of JSON
These were little more than object literal statements that were less clear due to their use of index-based arguments. Fixes #1077
Diffstat (limited to 'lib/handlebars/compiler/ast.js')
-rw-r--r--lib/handlebars/compiler/ast.js126
1 files changed, 0 insertions, 126 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js
index 599dab8..1699569 100644
--- a/lib/handlebars/compiler/ast.js
+++ b/lib/handlebars/compiler/ast.js
@@ -1,130 +1,4 @@
let AST = {
- Program: function(statements, blockParams, strip, locInfo) {
- this.loc = locInfo;
- this.type = 'Program';
- this.body = statements;
-
- this.blockParams = blockParams;
- this.strip = strip;
- },
-
- MustacheStatement: function(path, params, hash, escaped, strip, locInfo) {
- this.loc = locInfo;
- this.type = 'MustacheStatement';
-
- this.path = path;
- this.params = params || [];
- this.hash = hash;
- this.escaped = escaped;
-
- this.strip = strip;
- },
-
- BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {
- this.loc = locInfo;
- this.type = 'BlockStatement';
-
- this.path = path;
- this.params = params || [];
- this.hash = hash;
- this.program = program;
- this.inverse = inverse;
-
- this.openStrip = openStrip;
- this.inverseStrip = inverseStrip;
- this.closeStrip = closeStrip;
- },
-
- PartialStatement: function(name, params, hash, strip, locInfo) {
- this.loc = locInfo;
- this.type = 'PartialStatement';
-
- this.name = name;
- this.params = params || [];
- this.hash = hash;
-
- this.indent = '';
- this.strip = strip;
- },
-
- ContentStatement: function(string, locInfo) {
- this.loc = locInfo;
- this.type = 'ContentStatement';
- this.original = this.value = string;
- },
-
- CommentStatement: function(comment, strip, locInfo) {
- this.loc = locInfo;
- this.type = 'CommentStatement';
- this.value = comment;
-
- this.strip = strip;
- },
-
- SubExpression: function(path, params, hash, locInfo) {
- this.loc = locInfo;
-
- this.type = 'SubExpression';
- this.path = path;
- this.params = params || [];
- this.hash = hash;
- },
-
- PathExpression: function(data, depth, parts, original, locInfo) {
- this.loc = locInfo;
- this.type = 'PathExpression';
-
- this.data = data;
- this.original = original;
- this.parts = parts;
- this.depth = depth;
- },
-
- StringLiteral: function(string, locInfo) {
- this.loc = locInfo;
- this.type = 'StringLiteral';
- this.original =
- this.value = string;
- },
-
- NumberLiteral: function(number, locInfo) {
- this.loc = locInfo;
- this.type = 'NumberLiteral';
- this.original =
- this.value = Number(number);
- },
-
- BooleanLiteral: function(bool, locInfo) {
- this.loc = locInfo;
- this.type = 'BooleanLiteral';
- this.original =
- this.value = bool === 'true';
- },
-
- UndefinedLiteral: function(locInfo) {
- this.loc = locInfo;
- this.type = 'UndefinedLiteral';
- this.original = this.value = undefined;
- },
-
- NullLiteral: function(locInfo) {
- this.loc = locInfo;
- this.type = 'NullLiteral';
- this.original = this.value = null;
- },
-
- Hash: function(pairs, locInfo) {
- this.loc = locInfo;
- this.type = 'Hash';
- this.pairs = pairs;
- },
- HashPair: function(key, value, locInfo) {
- this.loc = locInfo;
- this.type = 'HashPair';
- this.key = key;
- this.value = value;
- },
-
// Public API used to evaluate derived attributes regarding AST nodes
helpers: {
// a mustache is definitely a helper if: