Avoid creating a new line comment when a block comment is preceded by a forward slash (#5562)

Fixes #5557
This commit is contained in:
Erik Simmler 2017-04-09 19:36:18 -04:00 committed by Logan Smyth
parent 216cbf5bd6
commit 769eddc788
4 changed files with 8 additions and 0 deletions

View File

@ -557,6 +557,9 @@ export default class Printer {
val = val.replace(/\n(?!$)/g, `\n${repeat(" ", indentSize)}`);
}
// Avoid creating //* comments
if (this.endsWith("/")) this._space();
this.withSource("start", comment.loc, () => {
this._append(val);
});

View File

@ -0,0 +1 @@
var foo = 1 / /* leading */ 1;

View File

@ -0,0 +1 @@
var foo=1/ /* leading */1;

View File

@ -0,0 +1,3 @@
{
"compact": true
}