diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-09-23 12:47:34 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-09-23 12:47:34 +0300 |
commit | a83b28503f4673aeb744b45306500584a6480e29 (patch) | |
tree | 52c34c1e72d32531dd3e1a6c7a1eb935a70c23ec /lib/transform.js | |
parent | 76d88b59dcd28b836b2cdaf7908bfd5acaa88ebc (diff) | |
download | tracifyjs-a83b28503f4673aeb744b45306500584a6480e29.tar.gz tracifyjs-a83b28503f4673aeb744b45306500584a6480e29.zip |
properly drop mutually-referring declarations that are not otherwise
referenced and have no side effects
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; |