Rename AST objects to match type names
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Exception from "../exception";
|
||||
|
||||
var AST = {
|
||||
ProgramNode: function(statements, blockParams, strip, locInfo) {
|
||||
Program: function(statements, blockParams, strip, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'Program';
|
||||
this.body = statements;
|
||||
@@ -10,7 +10,7 @@ var AST = {
|
||||
this.strip = strip;
|
||||
},
|
||||
|
||||
MustacheNode: function(rawParams, open, strip, locInfo) {
|
||||
MustacheStatement: function(rawParams, open, strip, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'MustacheStatement';
|
||||
|
||||
@@ -28,7 +28,7 @@ var AST = {
|
||||
this.strip = strip;
|
||||
},
|
||||
|
||||
BlockNode: function(sexpr, program, inverse, strip, locInfo) {
|
||||
BlockStatement: function(sexpr, program, inverse, strip, locInfo) {
|
||||
this.loc = locInfo;
|
||||
|
||||
this.type = 'BlockStatement';
|
||||
@@ -38,7 +38,7 @@ var AST = {
|
||||
this.strip = strip;
|
||||
},
|
||||
|
||||
PartialNode: function(sexpr, strip, locInfo) {
|
||||
PartialStatement: function(sexpr, strip, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'PartialStatement';
|
||||
this.sexpr = sexpr;
|
||||
@@ -48,13 +48,13 @@ var AST = {
|
||||
this.strip.inlineStandalone = true;
|
||||
},
|
||||
|
||||
ContentNode: function(string, locInfo) {
|
||||
ContentStatement: function(string, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'ContentStatement';
|
||||
this.original = this.value = string;
|
||||
},
|
||||
|
||||
CommentNode: function(comment, strip, locInfo) {
|
||||
CommentStatement: function(comment, strip, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'CommentStatement';
|
||||
this.value = comment;
|
||||
@@ -63,7 +63,7 @@ var AST = {
|
||||
strip.inlineStandalone = true;
|
||||
},
|
||||
|
||||
SexprNode: function(rawParams, hash, locInfo) {
|
||||
SubExpression: function(rawParams, hash, locInfo) {
|
||||
this.loc = locInfo;
|
||||
|
||||
this.type = 'SubExpression';
|
||||
@@ -72,7 +72,7 @@ var AST = {
|
||||
this.hash = hash;
|
||||
},
|
||||
|
||||
PathNode: function(data, parts, locInfo) {
|
||||
PathExpression: function(data, parts, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'PathExpression';
|
||||
|
||||
@@ -103,27 +103,27 @@ var AST = {
|
||||
this.depth = depth;
|
||||
},
|
||||
|
||||
StringNode: function(string, locInfo) {
|
||||
StringLiteral: function(string, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'StringLiteral';
|
||||
this.original =
|
||||
this.value = string;
|
||||
},
|
||||
|
||||
NumberNode: function(number, locInfo) {
|
||||
NumberLiteral: function(number, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'NumberLiteral';
|
||||
this.original =
|
||||
this.value = Number(number);
|
||||
},
|
||||
|
||||
BooleanNode: function(bool, locInfo) {
|
||||
BooleanLiteral: function(bool, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'BooleanLiteral';
|
||||
this.value = bool === 'true';
|
||||
},
|
||||
|
||||
HashNode: function(pairs, locInfo) {
|
||||
Hash: function(pairs, locInfo) {
|
||||
this.loc = locInfo;
|
||||
this.type = 'Hash';
|
||||
this.pairs = pairs;
|
||||
|
||||
@@ -32,9 +32,9 @@ export function prepareRawBlock(openRawBlock, content, close, locInfo) {
|
||||
throw new Exception(openRawBlock.sexpr.path.original + " doesn't match " + close, errorNode);
|
||||
}
|
||||
|
||||
var program = new this.ProgramNode([content], null, {}, locInfo);
|
||||
var program = new this.Program([content], null, {}, locInfo);
|
||||
|
||||
return new this.BlockNode(openRawBlock.sexpr, program, undefined, undefined, locInfo);
|
||||
return new this.BlockStatement(openRawBlock.sexpr, program, undefined, undefined, locInfo);
|
||||
}
|
||||
|
||||
export function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
|
||||
@@ -109,9 +109,9 @@ export function prepareBlock(openBlock, program, inverseAndProgram, close, inver
|
||||
}
|
||||
|
||||
if (inverted) {
|
||||
return new this.BlockNode(openBlock.sexpr, inverse, program, strip, locInfo);
|
||||
return new this.BlockStatement(openBlock.sexpr, inverse, program, strip, locInfo);
|
||||
} else {
|
||||
return new this.BlockNode(openBlock.sexpr, program, inverse, strip, locInfo);
|
||||
return new this.BlockStatement(openBlock.sexpr, program, inverse, strip, locInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user