diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-12-18 13:30:26 +0200 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-12-18 13:30:26 +0200 |
commit | be55a09edf7526cd325e3c954e0ae778a1f625b0 (patch) | |
tree | 81306151387f7063701d139d105cd40a364f3ed8 /lib | |
parent | 15a148ff6d5a1ec56e2e11bed7ec271da552c475 (diff) | |
download | tracifyjs-be55a09edf7526cd325e3c954e0ae778a1f625b0.tar.gz tracifyjs-be55a09edf7526cd325e3c954e0ae778a1f625b0.zip |
Take out all comments from an AST_Exit's value
Fix #372
Diffstat (limited to 'lib')
-rw-r--r-- | lib/output.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/output.js b/lib/output.js index 37e30c0e..1ef92dde 100644 --- a/lib/output.js +++ b/lib/output.js @@ -386,13 +386,14 @@ function OutputStream(options) { var comments = start.comments_before || []; // XXX: ugly fix for https://github.com/mishoo/UglifyJS2/issues/112 - // if this node is `return` or `throw`, we cannot allow comments before - // the returned or thrown value. - if (self instanceof AST_Exit && self.value - && self.value.start.comments_before - && self.value.start.comments_before.length > 0) { - comments = comments.concat(self.value.start.comments_before); - self.value.start.comments_before = []; + // and https://github.com/mishoo/UglifyJS2/issues/372 + if (self instanceof AST_Exit && self.value) { + self.value.walk(new TreeWalker(function(node){ + if (node.start.comments_before) { + comments = comments.concat(node.start.comments_before); + node.start.comments_before = []; + } + })); } if (c.test) { |