AST cleanup (dropped AST_StatementBase)

This commit is contained in:
Mihai Bazon
2012-10-03 15:41:11 +03:00
parent 9221ad62db
commit 3412498795
3 changed files with 25 additions and 23 deletions

View File

@@ -114,31 +114,28 @@ AST_Node.warn = function(txt, props) {
/* -----[ statements ]----- */
var AST_StatementBase = DEFNODE("StatementBase", null, {
var AST_Statement = DEFNODE("Statement", null, {
$documentation: "Base class of all statements",
});
var AST_Statement = DEFNODE("Statement", "body", {
$documentation: "Base class of all statements",
var AST_Debugger = DEFNODE("Debugger", null, {
$documentation: "Represents a debugger statement",
}, AST_Statement);
var AST_Directive = DEFNODE("Directive", "value scope", {
$documentation: "Represents a directive, like \"use strict\";",
}, AST_Statement);
var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", {
$documentation: "A statement consisting of an expression, i.e. a = 1 + 2.",
_walk: function(visitor) {
return visitor._visit(this, function(){
this.body._walk(visitor);
});
}
}, AST_StatementBase);
var AST_Debugger = DEFNODE("Debugger", null, {
$documentation: "Represents a debugger statement"
}, AST_StatementBase);
var AST_Directive = DEFNODE("Directive", "value scope", {
$documentation: "Represents a directive, like \"use strict\";"
}, AST_StatementBase);
var AST_SimpleStatement = DEFNODE("SimpleStatement", null, {
$documentation: "A statement consisting of an expression, i.e. a = 1 + 2."
}, AST_Statement);
var AST_BlockStatement = DEFNODE("BlockStatement", null, {
var AST_BlockStatement = DEFNODE("BlockStatement", "body", {
$documentation: "A block statement.",
_walk: function(visitor) {
return visitor._visit(this, function(){
@@ -158,7 +155,7 @@ function walk_body(node, visitor) {
});
};
var AST_Block = DEFNODE("Block", null, {
var AST_Block = DEFNODE("Block", "body", {
$documentation: "A block of statements (usually always bracketed)",
_walk: function(visitor) {
return visitor._visit(this, function(){
@@ -174,8 +171,13 @@ var AST_EmptyStatement = DEFNODE("EmptyStatement", null, {
}
}, AST_Statement);
var AST_StatementWithBody = DEFNODE("StatementWithBody", null, {
$documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`."
var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", {
$documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`.",
_walk: function(visitor) {
return visitor._visit(this, function(){
this.body._walk(visitor);
});
}
}, AST_Statement);
var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", {
@@ -325,7 +327,7 @@ var AST_If = DEFNODE("If", "condition alternative", {
/* -----[ SWITCH ]----- */
var AST_Switch = DEFNODE("Switch", "expression", {
var AST_Switch = DEFNODE("Switch", "body expression", {
$documentation: "A `switch` statement",
_walk: function(visitor) {
return visitor._visit(this, function(){