added $propdoc to AST nodes and some cleanups

hopefully we can make the AST documentation self-generating
This commit is contained in:
Mihai Bazon
2012-10-09 16:25:45 +03:00
parent 9ead49641d
commit 1b0aab2ce9
7 changed files with 181 additions and 51 deletions

View File

@@ -80,7 +80,7 @@ merge(Compressor.prototype, {
},
before: function(node, descend, in_list) {
if (node._squeezed) return node;
node = node.clone();
this.stack[this.stack.length - 1] = node = node.clone();
if (node instanceof AST_Scope) {
node.drop_unused(this);
node = node.hoist_declarations(this);
@@ -291,7 +291,7 @@ merge(Compressor.prototype, {
var ab = aborts(stat.body);
if (ab && ((ab instanceof AST_Return && !ab.value && in_lambda)
|| (ab instanceof AST_Continue && self === ab.target()))) {
|| (ab instanceof AST_Continue && self.$self === compressor.loopcontrol_target(ab.label)))) {
CHANGED = true;
var body = as_statement_array(stat.body).slice(0, -1);
stat = stat.clone();
@@ -308,7 +308,7 @@ merge(Compressor.prototype, {
var ab = aborts(stat.alternative);
if (ab && ((ab instanceof AST_Return && !ab.value && in_lambda)
|| (ab instanceof AST_Continue && self === ab.target()))) {
|| (ab instanceof AST_Continue && self.$self === compressor.loopcontrol_target(ab.label)))) {
CHANGED = true;
stat = stat.clone();
stat.body = make_node(AST_BlockStatement, stat.body, {
@@ -1187,7 +1187,7 @@ merge(Compressor.prototype, {
var last_branch = self.body[self.body.length - 1];
if (last_branch) {
var stat = last_branch.body[last_branch.body.length - 1]; // last statement
if (stat instanceof AST_Break && !stat.label)
if (stat instanceof AST_Break && compressor.loopcontrol_target(stat.label) === self.$self)
last_branch.body.pop();
}
return self;