From 74a84e247360a76cffaf7160bee07b74fabc0cda Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 29 Dec 2014 11:13:50 +1100 Subject: [PATCH] fix duplicate comments being output, breaking code --- CHANGELOG.md | 1 + lib/6to5/types/index.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54839e0afb..f505467079 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Gaps between patch versions are faulty/broken releases. ## 2.2.0 * Make `system` module formatter modules anonymous by default. + * Fix duplicate comments being output, breaking code. ## 2.1.0 diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index dd839faa23..4745caedad 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -293,8 +293,9 @@ t.removeComments = function (child) { }; t.inheritsComments = function (child, parent) { - child.leadingComments = _.compact([].concat(child.leadingComments, parent.leadingComments)); - child.trailingComments = _.compact([].concat(child.trailingComments, parent.trailingComments)); + _.each(["leadingComments", "trailingComments"], function (key) { + child[key] = _.uniq(_.compact([].concat(child[key], parent[key]))); + }); return child; };