fix duplicate comments on property key shorthands - fixes #234

This commit is contained in:
Sebastian McKenzie 2014-12-07 11:43:51 +11:00
parent bf07f54e57
commit c1c22ed5f7
5 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,7 @@
# 1.14.18
* Fix files only containg comments not being output.
* Fix duplicate comments on property key shorthands.
# 1.14.17

View File

@ -1,4 +1,8 @@
var t = require("../../types");
var _ = require("lodash");
exports.Property = function (node) {
if (!node.shorthand) return;
node.shorthand = false;
node.key = t.removeComments(_.clone(node.key));
};

View File

@ -295,11 +295,6 @@ t.inheritsComments = function (child, parent) {
return child;
};
t.removeComments = function (node) {
delete node.leadingComments;
delete node.trailingComments;
};
t.inherits = function (child, parent) {
child.loc = parent.loc;
child.end = parent.end;

View File

@ -0,0 +1,4 @@
const A = 'a';
const o = {
A // comment
};

View File

@ -0,0 +1,4 @@
const A = 'a';
const o = {
A: A // comment
};