diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-10-28 09:39:29 +0200 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-10-28 09:39:29 +0200 |
commit | 0358e376f04b5f67616d57ccfd0fafbe1b9a6979 (patch) | |
tree | 17e7f179889708155e971003052ebeb70b52549e /lib | |
parent | b47f7b76b9f0ff5e34d744439f327897a592f675 (diff) | |
download | tracifyjs-0358e376f04b5f67616d57ccfd0fafbe1b9a6979.tar.gz tracifyjs-0358e376f04b5f67616d57ccfd0fafbe1b9a6979.zip |
Fix codegen for when comments_before is undefined.
Fix #333
Diffstat (limited to 'lib')
-rw-r--r-- | lib/output.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/output.js b/lib/output.js index e7f3f4dd..7eb685a0 100644 --- a/lib/output.js +++ b/lib/output.js @@ -378,14 +378,15 @@ function OutputStream(options) { var start = self.start; if (start && !start._comments_dumped) { start._comments_dumped = true; - var comments = start.comments_before; + 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.length > 0) { - comments = (comments || []).concat(self.value.start.comments_before); + 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 = []; } |