fix duplicate comments on property key shorthands - fixes #234
This commit is contained in:
parent
bf07f54e57
commit
c1c22ed5f7
@ -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
|
||||
|
||||
|
||||
@ -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));
|
||||
};
|
||||
|
||||
@ -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;
|
||||
|
||||
4
test/fixtures/transformation/es6-property-name-shorthand/comments/actual.js
vendored
Normal file
4
test/fixtures/transformation/es6-property-name-shorthand/comments/actual.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
const A = 'a';
|
||||
const o = {
|
||||
A // comment
|
||||
};
|
||||
4
test/fixtures/transformation/es6-property-name-shorthand/comments/expected.js
vendored
Normal file
4
test/fixtures/transformation/es6-property-name-shorthand/comments/expected.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
const A = 'a';
|
||||
const o = {
|
||||
A: A // comment
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user