more sequence optimizations (lift some sequences above binary/unary expressions so that we can avoid parens)

This commit is contained in:
Mihai Bazon
2012-10-22 11:49:58 +03:00
parent 41be8632d3
commit 30faaf13ed
4 changed files with 102 additions and 1 deletions

View File

@@ -581,6 +581,18 @@ var AST_Seq = DEFNODE("Seq", "car cdr", {
}
return list;
},
to_array: function() {
var p = this, a = [];
while (p) {
a.push(p.car);
if (p.cdr && !(p.cdr instanceof AST_Seq)) {
a.push(p.cdr);
break;
}
p = p.cdr;
}
return a;
},
add: function(node) {
var p = this;
while (p) {