diff options
Diffstat (limited to 'lib/transform.js')
-rw-r--r-- | lib/transform.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/transform.js b/lib/transform.js index 743dd6e7..df51eac3 100644 --- a/lib/transform.js +++ b/lib/transform.js @@ -68,14 +68,17 @@ TreeTransformer.prototype = { node.DEFMETHOD("transform", function(tw, in_list){ var x, y; tw.push(this); - x = tw.before(this, function(){ - descend(x, tw); - }, in_list); + x = tw.before(this, descend, in_list); if (x === undefined) { - x = this.clone(); - descend(x, tw); - y = tw.after(this, in_list); - if (y !== undefined) x = y; + if (!tw.after) { + x = this; + descend(x, tw); + } else { + x = this.clone(); + descend(x, tw); + y = tw.after(this, in_list); + if (y !== undefined) x = y; + } } tw.pop(); return x; |