aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2013-12-18 15:54:12 +0200
committerMihai Bazon <mihai@bazon.net>2013-12-18 15:54:12 +0200
commit7a30d826b89197f7a74001af83676c39277b0eab (patch)
tree6e26216b522cda09e7e6884b51560761a2230d42
parentbe55a09edf7526cd325e3c954e0ae778a1f625b0 (diff)
downloadtracifyjs-7a30d826b89197f7a74001af83676c39277b0eab.tar.gz
tracifyjs-7a30d826b89197f7a74001af83676c39277b0eab.zip
Better fix for comments in AST_Exit
Close #374
-rw-r--r--lib/output.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/output.js b/lib/output.js
index 1ef92dde..9ed155b4 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -389,10 +389,16 @@ function OutputStream(options) {
// 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) {
+ if (node.start && node.start.comments_before) {
comments = comments.concat(node.start.comments_before);
node.start.comments_before = [];
}
+ if (node instanceof AST_Function ||
+ node instanceof AST_Array ||
+ node instanceof AST_Object)
+ {
+ return true; // don't go inside.
+ }
}));
}