add method

This commit is contained in:
leon.li 2015-02-02 14:46:41 +08:00
parent 5538ec7bd8
commit c7cca91770

View File

@ -58,6 +58,8 @@ TreeTransformer.prototype = new TreeWalker;
node.DEFMETHOD("transform", function(tw, in_list){
var x, y;
tw.push(this);
this.walker = new TreeWalker;
this.walker.stack = tw.stack.concat();
if (tw.before) x = tw.before(this, descend, in_list);
if (x === undefined) {
if (!tw.after) {
@ -75,8 +77,10 @@ TreeTransformer.prototype = new TreeWalker;
});
};
function do_list(list, tw) {
return MAP(list, function(node){
function do_list(list, tw)
{
return MAP(list, function(node , i){
node._position = i;
return node.transform(tw, true);
});
};