remove comments from old node after inheriting from new one when replacing nodes - closes #2490, closes #2489

This commit is contained in:
Sebastian McKenzie 2015-10-05 16:27:17 +01:00
parent fa88b1c00d
commit 6740561f91

View File

@ -137,8 +137,11 @@ export function replaceWith(replacement, whateverAllowed) {
return this.replaceExpressionWithStatements([replacement]);
}
var oldNode = this.node;
if (oldNode) t.inheritsComments(replacement, oldNode);
let oldNode = this.node;
if (oldNode) {
t.inheritsComments(replacement, oldNode);
t.removeComments(oldNode);
}
// replace the node
this._replaceWith(replacement);